Environment:
macOS Mojave
torchvision 0.2.1
pytorch 1.0.0
python 3.6.7
my problem shows as following:
import torchvision
dataset=torchvision.datasets.ImageFolder('/Users/administer/Desktop/D-HAZY_DATASET1/Middlebury_Hazy')
Traceback (most recent call last):
File "", line 1, in
File "/anaconda3/lib/python3.6/site-packages/torchvision/datasets/folder.py", line 178, in __init__
target_transform=target_transform)
File "/anaconda3/lib/python3.6/site-packages/torchvision/datasets/folder.py", line 79, in __init__
"Supported extensions are: " + ",".join(extensions)))
RuntimeError: Found 0 files in subfolders of: /Users/administer/Desktop/D-HAZY_DATASET1/Middlebury_Hazy
Supported extensions are: .jpg,.jpeg,.png,.ppm,.bmp,.pgm,.tif
But there have images, they are 'bmp' format in that path. Could anyone tell me how can I fix this problem?
check file extension, and https://discuss.pytorch.org/ is a better place for discussion.
Your error is here: RuntimeError: Found 0 files in subfolders of: /Users/administer/Desktop/D-HAZY_DATASET1/Middlebury_Hazy
That directory seems to be empty. Can you double check to make sure? This seems to be a valid bug.
As the others have said, your dataset is empty and the error is raised in
https://github.com/pytorch/vision/blob/98ca260bc834ec94a8143e4b5cfe9516b0b951a2/torchvision/datasets/folder.py#L86-L87
I'd say that it's better to raise an error in this case than to silently pass (and have unexpected behavior), thus I'm closing this issue but let me know if you disagree
hello
you have to create a sub directory in your images directory,
e.g if images directory is:
./VOC2007/JPEGImages
dataset=torchvision.datasets.ImageFolder('./VOC2007')
Most helpful comment
hello
you have to create a sub directory in your images directory,
e.g if images directory is:
./VOC2007/JPEGImages
dataset=torchvision.datasets.ImageFolder('./VOC2007')