I have 3662 images in my trainset, batchsize is 128. When I am performing iter(dataloader).next() it takes about 20 seconds for this batch size. I narrowed down on the problem and found that resizing the image is taking up most of the time. I am using torchvision.transforsms.Resize() to resize the images.
Have you tried increasing the
num_workers parameter of data loader?
Yes, I did. It became slower.