When trying to visualize some sample data from the train_loader that generated using torch.utils.data.DataLoader(train_data, batch_size=64, shuffle=True) method i found that the generated image with its corresponding labels dose not match the actual classes images in the dataset .
example:
here, i visualize the first two images in the tainloader and they have 81 and 12 as labels.
Thank you, I knew the reason for that, The Dataloader re-index the classes with numerical values even that the dataset already represented the classes with numerical values and the new index deals with class number as a string and sorting it alphabetically. so, the dataset.class_to_idx gives the new index as {‘1’: 0, ‘10’: 1, ‘100’: 2, ‘101’: 3, ‘102’: 4, ‘11’: 5, ‘12’: 6, ‘13’: 7,…}, that is why class images in the dataset dose not similar to the images with same numerical label in the dataloader.
and i thought that if the classes has numerical representation , the loader will take it in account and use this values but it is not what happening.