Pytorch: Can’t load images using ImageFolder
I’m trying to load images using “ImageFolder”.

data_dir = './train_dog'          # directory structure is    
train_dog/image
dset = datasets.ImageFolder(data_dir, transform)
train_loader = torch.utils.data.DataLoader(dset, batch_size=128, shuffle=True)


However, it seems not working. So I checked the stored data as below

print dset[0][0]


Then it shows only 3 tensors(size 64x64). 

[torch.FloatTensor of size 3x64x64]


There are more than 10,000 images in the folder. How come it can’t store all data?

You should try this: 

print len(dset)


which represents the size of the dataset, aka the number of image files.

dset[0] means the (shuffled) first index of the dataset, where dset[0][0] contains the input image tensor and dset[0][1] contains the corresponding label or target.
