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 19