weiaicunzai / pytorch-cifar100

Practice on cifar100(ResNet, DenseNet, VGG, GoogleNet, InceptionV3, InceptionV4, Inception-ResNetv2, Xception, Resnet In Resnet, ResNext,ShuffleNet, ShuffleNetv2, MobileNet, MobileNetv2, SqueezeNet, NasNet, Residual Attention Network, SENet, WideResNet)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: for batch_index, (images, labels) in enumerate(cifar100_training_loader)

zhaobingshuai opened this issue · comments

您好,我在运行您的程序时在train.py中train函数、第33行 for batch_index, (images, labels) in enumerate(cifar100_training_loader)报错如下:
发生异常: TypeError
Traceback (most recent call last):
File "/home/zbs/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 57, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/zbs/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in default_collate
return [default_collate(samples) for samples in transposed]
File "/home/zbs/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in
return [default_collate(samples) for samples in transposed]
File "/home/zbs/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 140, in default_collate
raise TypeError((error_msg.format(type(batch[0]))))
TypeError: batch must contain tensors, numbers, dicts or lists; found <class 'torchvision.transforms.Compose'>
File "/home/zbs/Desktop/pytorch-cifar100/train.py", line 33, in train
for batch_index, (images, labels) in enumerate(cifar100_training_loader):
File "/home/zbs/Desktop/pytorch-cifar100/train.py", line 160, in
train(epoch)
请问您能帮我解决吗?非常感谢,Nice work!

I'm getting this error too and have no idea why

请问你能告诉我如何复现这个bug吗?我从来没遇到过这个bug。而且我的代码也更新了不少,你可以试试更新下代码再运行,看是否还有这个bug。

commented

我在win环境下运行的 也遇到了这个问题。可能和系统有关。