What does Datasets.ImageFolder() returns
It returns Dataset object with contains tuples => (image, class)
.
https://pytorch.org/docs/stable/torchvision/datasets.html#torchvision.datasets.ImageFolder
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 -
root/dog/xxx.png
root/dog/xxy.png
root/dog/xxz.png
root/cat/123.png
root/cat/nsdf3.png
root/cat/asd932_.png
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.