Obtain the class and class index

how do i print the class and class indices values,where i am using torchvision.datasets.ImageFolder

You could print the dataset.classes and dataset.class_to_idx attributes.


File “main.py”, line 193, in main
NameError: global name ‘dataset’ is not defined

dataset is a placeholder name for the Dataset object variable in your script, so you would need to change it based on your variable naming.