Hi guys,
When I use:
torchvision.datasets.ImageFolder
to import train dataset I get this Error:
RuntimeError: Found 0 images in subfolders of: /data/train/
Supported image extensions are: .jpg,.jpeg,.png,.ppm,.bmp,.pgm,.tif,.tiff,webp
Any help!?
1 Like
Did you check if there are images in /data/train
? Maybe your training set is elsewhere.
Thank you for replying, I made sure that the folder contains the images
Are you maybe passing an absolute path accidentally instead of a relative one?
I.e. /data/train/
instead of ./data/train/
?
tjwang888
(Johnson Wang)
June 3, 2019, 2:06am
5
I got the same issue. Is there any other solution for that? @@
iArunava
(Arunava Chakraborty)
June 3, 2019, 2:32am
6
Hi! @tjwang888 ,
Welcome to the PyTorch Community
Coming to your question, please make sure that the
image types are of supported formats
there are images in the directory
And that you are passing the path correctly.
If you have checked these 3 and still facing an error.
Show us your StackTrace and output of the ls
command for that same path.
Please wrap your code in ```
Thanks
tjwang888
(Johnson Wang)
June 3, 2019, 3:44am
7
I think those 3 items you list is OK, but it still showed the error message below:
Traceback (most recent call last):
File “cnn-poc-01.py”, line 37, in
trainloader, testloader = load_split_train_test(data_dir, .2)
File “cnn-poc-01.py”, line 18, in load_split_train_test
train_data = datasets.ImageFolder(datadir, transform=train_transforms)
File “C:\Anaconda3\lib\site-packages\torchvision\datasets\folder.py”, line 209, in init
is_valid_file=is_valid_file)
File “C:\Anaconda3\lib\site-packages\torchvision\datasets\folder.py”, line 97, in init
"Supported extensions are: " + “,”.join(extensions)))
RuntimeError: Found 0 files in subfolders of: …/dataset/wafer_defect/test
Supported extensions are: .jpg,.jpeg,.png,.ppm,.bmp,.pgm,.tif,.tiff,.webp
Thank you for your kindly help. ^^
1 Like
Hi @tjwang888 @Abdelrahman_Mohamed ,
I had the same problem as you. Then I found out you have to set your directory one step before.
For example, you want to read an image /yourfolder/yourcode/yourimage/image.png
You should set at /yourfolder/yourcode/ rather than /yourfolder/yourcode/yourimage. I think that can help you :))
1 Like
wymankels
(Kelsey Wyman )
March 28, 2022, 8:26pm
9
This helped me solve my error - thanks!