How to get the class names from torchvision.datasets

When I load the CIFAR 100 dataset from torchvision.datasets, class label (target) from getitem function is an integer value. However, I also want to know the corresponding class name, e.g., beaver and dolphin. How to get the class label to class name mapping?

Thanks in advance.

1 Like

You can find meta in the original CIFAR 10/100 python.tar.gz. Then unpickle it, you’ll get a list of class names.