Google Colab FIles

I downloaded a dataset from kaggle and uploaded in colab.
I gave the correct path of the required folder to ImageFolder function.
But it is showing this error :point_down: :point_down:

This happens everytime. Whenever I tried to create dataset from the folder path which directly contains images , it doesn’t work. But when I pass the path of the folder which is one level higher than the folder containing the images then it works.

But in this case different folders are containing different kinds of images. So I don’t want to create a single dataset for all of them.

Can someone tell me how can I do this?

What files/subfolders does ‘monet_jpg’ contain?

I suspect you tried to use ImageFolder incorrectly. It expects there to be subfolders (which represent classes) with the actual images for each class. I think there are only images and no subfolders which could be used used for classification.

yes it does not have any subfolders.
And i want it that way because I am using that images for GAN’s and not for Image Classification model.
So i want them all to have the same class

So you can’t use ImageFolder, because it’s purpose is to be used along with subfolders for classes.

You say that you need images for GAN’s, not classification, but part of the GAN problem is classification of real/fake image.

I would just define some custom dataset class :stuck_out_tongue:

You will need Image.open, os.listdir and the overloaded __getitem__ and __len__ for Dataset class.

yes you are right the part of gan’s is classification itself but it is a binary classification and images of the fake class are generated by generators.
I will follow you instructions and create a custom dataset class :+1:

Would be good idea to make it a bit “generic” because it seems like common need to have such single-image dataset returning images from a specific directory.

I had somewhere such heresy :laughing: so can help if you need.

I will first try it myself and then ask for your help if I am getting errors :smiley: