torch.utils.data.DataLoader, By which order image files are loaded?

I am using DataLoader as follows:

train_loader = torch.utils.data.DataLoader(train_folders, batch_size=10, shuffle=False) 
test_loader = torch.utils.data.DataLoader(test_folders, batch_size=10, shuffle=False)

Imagine that I have 2 folders in the data set as follows:

Class A: A1.png, A2.png. A3.png. ā€¦
Class B: B1.png, B2.png. B3.png. ā€¦

I would like to know by which order Data Loader loads the image files. As an example, which image files are present in the 1st batch, 2nd batch, etc.

Why do I ask this question?
I am designing CNN for Regression problem not Classification. Every image file has a numeric output. Numerical data are saved in a csv file for all images. I need to relate the numeric data with the images loaded by Data Loader.

Hi, it depends on the dataset (train_folders) that you are using. Iā€™d advise you to create your custom dataset class. That way you can also return the path of the image and the problem is solved.

tutorial

2 Likes