Imagefolder can't get image

when i use imagefolder,it had error:
Traceback (most recent call last):
File “drive/gan/”, line 172, in
File “drive/gan/”, line 59, in train
dataset = tv.datasets.ImageFolder(opt.data_path,transform=transforms)
File “/usr/local/lib/python3.6/dist-packages/torchvision/datasets/”, line 103, in init
"Supported image extensions are: " + “,”.join(IMG_EXTENSIONS)))
RuntimeError: Found 0 images in subfolders of: drive/ganData/
Supported image extensions are: .jpg,.jpeg,.png,.ppm,.bmp,.pgm
there is the code:
transforms = tv.transforms.Compose([
tv.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))

dataset = tv.datasets.ImageFolder('drive/ganData/',transform=transforms)
dataloader =,
                                     batch_size = opt.batch_size,
                                     shuffle = True,
                                     num_workers= opt.num_workers,

there is the data:

Where is drive located? Is it a subfolder in your current working folder?
If so, change it to ./drive/danData/.
I think the path cannot be understood.

I have a complete and perfect file path to a folder of .jpg files, and I have this same problem/error. I’ve made sure the path has no errors.

1 Like

Hi ,I m also facing ''Found 0 files in subfolders ‘’
My train folder has 3 subfolders structures.PNG images are placed in label1 folder, label3 and label2 folders.Random random image series are saved in 1…30.png in label1 folder. 92.png ,2000.png in label2 and label3

Could you share the code where you initialize your ImageFolder dataset? I guess the path might be the issue, e.g. by passing a relative path while being in the wrong folder.

trainset=torchvision.datasets.ImageFolder("C:/Users/join2/Desktop/updates/data/train/",transform=transform), batch_size= 4)