标签:mini torchvision 迭代 imagnet train 图片 data 读取
da=torchvision.transforms.Compose([torchvision.transforms.ToTensor()])#必须有这步否则会出现
default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found <class ‘PI
train_data=torchvision.datasets.ImageFolder('train1/',transform=da)#读取图片并将其图片像素转为tensor
train=torch.utils.data.DataLoader(train_data,batch_size=5)#得到可迭代训练数据集
for i, (images, labels) in enumerate(train):
print(images.shape)
标签:mini,
torchvision,
迭代,
imagnet,
train,
图片,
data,
读取
From: https://www.cnblogs.com/hahaah/p/16584914.html