The generated images-labels from Dataloader not similar to the actual class data

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.


but the samples from 81 class in the dataset dose not similar to this image as shown.

and it is class 12 from the dataset.

so, I need to know why the tarin_loader data-labels dosen,t match the actual data-classes .

Did you use a custom Dataset class in your train_loader? Do you use the DataLoader shuffle argument or a custom shuffling?

No i used the default Dataset class, and i used the DataLoader shuffle argument not custom one

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.