erobic
(Robik Shrestha)
1
I am having trouble with the dataloader.
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
dataset = datasets.ImageFolder(root='images', transform=transforms.Compose([normalize]))
test_loader = torch.utils.data.DataLoader(dataset, batch_size=4, shuffle=True)
for i, (input, target) in enumerate(test_loader):
pass
Error:
TypeError: zip argument #1 must support iteration
The “images” directory has single subdirectory with single image.
1 Like
vishwakftw
(Vishwak Srinivasan)
2
Maybe you could do something like this:
for i, itr in enumerate(test_loader):
input, target = itr[0], itr[1]
pass
erobic
(Robik Shrestha)
3
It gives the same error. I think the problem is with test_loader not being iterable!
erobic
(Robik Shrestha)
4
Oh silly mistake. I forgot to inclue ToTensor() transform.
This works;
dataset = datasets.ImageFolder(root='images', transform=transforms.Compose([transforms.ToTensor(), normalize]))
1 Like