How to get the class names from torchvision.datasets


(Kimin Lee) #1

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.


(Moskomule) #2

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