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.

print(dataset.classes)

File “main.py”, line 193, in main
print(dataset.classes)
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.