Hi,
You can use class_to_idx attribute of ImageFolder. So train_data.class_to_idx will give you a dictionary with key as class name and id as its value. You can find class names by checking ids within this dictionary.