I've been using PyTorch FID to calculate FID over real/fake samples of pix2pix models.
But its returning this error... each folder has 4k images of 256x256 pixels (.png)
Would I need to use imagemagick and try mogrify the images to convert them on jpg format?
(base) C:\Users\Pichau\pytorch-CycleGAN-and-pix2pix>python -m pytorch_fid ./results/40K_Rplan_Black_256/test_5/images/_real_B ./results/40K_Rplan_Black_256/test_5/images/_fake_B
100%|██████████████████████████████████████████████████████████████████████████████████| 80/80 [10:48<00:00, 8.10s/it]
42%|██████████████████████████████████▊ | 34/80 [04:28<06:03, 7.90s/it]
Traceback (most recent call last):
File "C:\Users\Pichau\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Pichau\anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Pichau\anaconda3\lib\site-packages\pytorch_fid\__main__.py", line 4, in <module>
pytorch_fid.fid_score.main()
File "C:\Users\Pichau\anaconda3\lib\site-packages\pytorch_fid\fid_score.py", line 249, in main
fid_value = calculate_fid_given_paths(args.path,
File "C:\Users\Pichau\anaconda3\lib\site-packages\pytorch_fid\fid_score.py", line 238, in calculate_fid_given_paths
m2, s2 = _compute_statistics_of_path(paths[1], model, batch_size,
File "C:\Users\Pichau\anaconda3\lib\site-packages\pytorch_fid\fid_score.py", line 218, in _compute_statistics_of_path
m, s = calculate_activation_statistics(files, model, batch_size,
File "C:\Users\Pichau\anaconda3\lib\site-packages\pytorch_fid\fid_score.py", line 204, in calculate_activation_statistics
act = get_activations(files, model, batch_size, dims, cuda)
File "C:\Users\Pichau\anaconda3\lib\site-packages\pytorch_fid\fid_score.py", line 106, in get_activations
images = np.array([imread(str(f)).astype(np.float32)
File "C:\Users\Pichau\anaconda3\lib\site-packages\pytorch_fid\fid_score.py", line 106, in <listcomp>
images = np.array([imread(str(f)).astype(np.float32)
File "C:\Users\Pichau\anaconda3\lib\site-packages\pytorch_fid\fid_score.py", line 71, in imread
return np.asarray(Image.open(filename), dtype=np.uint8)[..., :3]
File "C:\Users\Pichau\anaconda3\lib\site-packages\numpy\core\_asarray.py", line 102, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'PngImageFile'
I've been using PyTorch FID to calculate FID over real/fake samples of pix2pix models. But its returning this error... each folder has 4k images of 256x256 pixels (.png)
Would I need to use
imagemagick
and trymogrify
the images to convert them onjpg
format?