Closed Royalbx closed 5 months ago
Have you solved it please, I'm getting the same error
same problem
Me either. Is there anybody who solved the problem?
It's just that the path to the image is written incorrectly and the folder where the image is guaranteed to be read. If it doesn't work, convert it to .npz format and try reading it again!
I had this error for two reasons. Firstly, ensure that the file extension is one of the following:
IMAGE_EXTENSIONS = {'bmp', 'jpg', 'jpeg', 'pgm', 'png', 'ppm','tif', 'tiff', 'webp'}
It must also be lowercase (My .JPEG files were not being read).
Secondly, it does not search subdirectories, which is annoying if you have train and test sets, subclasses, etc. However, if you dive into the source code and change one letter on line 242 from
for file in path.glob('*.{}'.format(ext))])
to
for file in path.rglob('*.{}'.format(ext))])
This should search the directory recursively.
I get the error, and don't know how to solve it. python -m pytorch_fid D:/Code/dcgan/dataset/cargo D:/Code/PyTorch-GAN/implementations/wgan_gp/cargo_generat2
pytorch_fid.fid_score.main()
File "D:\Anaconda\Anaconda3\envs\GAN\lib\site-packages\pytorch_fid\fid_score.py", line 317, in main
num_workers)
File "D:\Anaconda\Anaconda3\envs\GAN\lib\site-packages\pytorch_fid\fid_score.py", line 260, in calculate_fid_given_paths
dims, device, num_workers)
File "D:\Anaconda\Anaconda3\envs\GAN\lib\site-packages\pytorch_fid\fid_score.py", line 244, in compute_statistics_of_path
dims, device, num_workers)
File "D:\Anaconda\Anaconda3\envs\GAN\lib\site-packages\pytorch_fid\fid_score.py", line 228, in calculate_activation_statistics
act = get_activations(files, model, batch_size, dims, device, num_workers)
File "D:\Anaconda\Anaconda3\envs\GAN\lib\site-packages\pytorch_fid\fid_score.py", line 126, in get_activations
num_workers=num_workers)
File "D:\Anaconda\Anaconda3\envs\GAN\lib\site-packages\torch\utils\data\dataloader.py", line 274, in init
batch_sampler = BatchSampler(sampler, batch_size, drop_last)
File "D:\Anaconda\Anaconda3\envs\GAN\lib\site-packages\torch\utils\data\sampler.py", line 219, in init__
"but got batch_size={}".format(batch_size))
ValueError: batch_size should be a positive integer value, but got batch_size=0
Warning: batch size is bigger than the data size. Setting batch size to data size Traceback (most recent call last): File "D:\Anaconda\Anaconda3\envs\GAN\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\Anaconda\Anaconda3\envs\GAN\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\Anaconda\Anaconda3\envs\GAN\lib\site-packages\pytorch_fid__main.py", line 3, in