Is there bug in DataLoader or ImageFolder?

there are 2599 pics, but the results are only with the first 40…
some scripts are as follows:
dataset = dset.ImageFolder(root=opt.dataroot, transform=transform )
assert dataset
dataloader = torch.utils.data.DataLoader(dataset, batch_size=opt.batchSize,
shuffle=False, num_workers=int(opt.workers))
for i, data in enumerate(dataloader, 0):
vutils.save_image(recon_image.data[i], ‘result/celea_ce/val_fake_%d.png’ % (i), normalize=True)

and debug snap is follow:


imgs.length is 2599, however the final i is 40…

what’s your batch size? I assume that it is about 64, then it makes sense as 64*40=2560.

yes, it is 64, so, why is it so…

got it, it is the code logic error, the for loop should be outermost…

the final i is the total number of batches, with each batch contain 64 images.

yes, i should check my code logic, thank you.