Have question about torchvision ImageFolder

As you can see in this picture above there are lots of image files in that directory.

I don’t know why the number of datapoints is 2

doesn’t it mean the imagefolder reads 2 imagefiles?

I have no idea why ImageFolder doesn’t reads the whole imagefiles I have in that directory.


just found another weird thing.

why in the mask directory gets 4 image data???

all the files have same name but mask folder with mask on the back.
just like this

MRI folder —> TCGS_CS_4941.tif
Mask folder —> TCGS_CS_4941_mask.tif

As per the documentation documentation, ImageFolder expects images to be organized as class/instance.tif with class subfolders.

Best regards


hmm but I still don’t get it.
Even if I do what I did,
I think It needs to get the whole image files with 1 class which is ‘BrainMRI_train’ in my case.

No, it’s not in a subfolder? You would need to create a dummy subfolder of MRI and move the tifs to that.

Best regards


1 Like


Thank you for the replies.
I created subfolders but now I’m getting only 1 datapoint each…


oh nevermind I think I figured it out
I didn’t need to change the root directory all the way to subdirectory.

thank you very much!!

Best regards