Questions about ImageFolder and Customized Datasets

I have a folder contains all of images(no other folders). And each of the image has its name like : xxxx1.png xxxx2.png … .I also have a dictionary that maps the name ‘xxxx1’ to its label .

My problem is that i want to use dataloader to get train_x and train_y. i don’y know how to make get the label. I’ve see some source code and it seems that i should have my 'dataLoader '. Can someone provide a example.

Thank you !

Maybe this example data_loader will help you. (You can find the label in def __getitem__(self, index) through the dictionary)

1 Like

This maybe helpful.

1 Like