I have a problem for loading my dataset as  I consider to function.
I have two directories, one is considered for feeding to the ConvNet and the other one is considered for target images to be used in loss function. In this regard, I declare two data loaders  to read images from directories. But when I read images that are loaded from train loader and target loader (train_loader and target_loader), they don’t load the images from both directories with the same name. Actually, I considered that the images in the train and target directories have the same name in order to match images with their target.
It seems that data_loader in pytorch load images randomly in each iteration. How can I do this purpose? please guide me.
is there another method for loading the target images in a way that they can be considered instead of labels for using in loss function?  The default method is that images are loaded and the directory name is considered as their labels. How about replacing labels with images from target directory?
Thank you in advance