ImageFolder return type

What does Datasets.ImageFolder() returns

It returns Dataset object with contains tuples => (image, class).

Thanks. But as i was doing a competition on kaggle. Dataset was a folder of images with as imageID and a csv file of labels with the respective imageID. As i loaded the images from the folder which only had images no classes. How would classes of the images be refered. And all the classes were zero

datasets. ImageFolder will infer classes ‘cat’ and ‘dog’ if your directory is organized as follows -



Here’s a related thread - Custom Dataset labeling from CSV

Thanks for the link. That is what i m having trouble in.

Thanks airbend3r. I would also like to add that it does not return that, but the information can be gotten using the “.imgs” attribute.