其他分享
首页 > 其他分享> > 读取mini-imagnet图片并将其转为可迭代对象训练神经网络

读取mini-imagnet图片并将其转为可迭代对象训练神经网络

作者:互联网

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,da,train,transforms,images,data
来源: https://www.cnblogs.com/hahaah/p/16584914.html