GaParmar / clean-fid

PyTorch - FID calculation with proper image resizing and quantization steps [CVPR 2022]
https://www.cs.cmu.edu/~clean-fid/
MIT License
903 stars 69 forks source link

Resolution in image folders #2

Closed vinduon closed 2 years ago

vinduon commented 3 years ago

Hi,

I am a little confused that should the resolution of images in 2 folders be the same or different (folder1: 256x256, folder2: 1024x1024)? If not, can we use PIL to resize it or use torch transform resize?

Many thanks.

GaParmar commented 3 years ago

Hi,

Can you provide some additional details about your use case? The clean-fid will resize the images to expected size automatically. You should not need to resize the images manually.

Regards, Gaurav

vinduon commented 3 years ago

Thank you for your reply. I got this problem when running the code:

Screenshot from 2021-06-22 09-39-56

My code is:

Screenshot from 2021-06-22 09-43-34

How can i fix this? I try to do this on 256, 1024 resolution images but it always exposes this error.

GaParmar commented 3 years ago

Can you try

score = fid.compute_fid(fdir1, fdir2, num_workers=0)
vinduon commented 3 years ago

Can you try

score = fid.compute_fid(fdir1, fdir2, num_workers=0)

It still doesn't work. The same error. I use python 3.6.13. After that I changed to python 3.7 and the error is the same. I use conda env.

vinduon commented 3 years ago

The error is the same on google colab. I do not know that fdir1 and fdir2 should be both .npz or just a folder of images?

GaParmar commented 3 years ago

The fdir1 and fdir2 should be folder of images. Can you try this colab notebook https://colab.research.google.com/drive/1ElGAHvlwTilIf_3D3cw1boirCEkFsAWI?usp=sharing

I just ran it and it doesn't give me the error.

vinduon commented 3 years ago

Screenshot from 2021-06-24 11-08-48

It just crashes the session. I do not know why? This is exactly what I met in my pc.

GaParmar commented 2 years ago

Could you try these changes that can cause the Segmentation Fault:

hangg7 commented 2 years ago

@GaParmar @duongquangvinh Hi guys, I have run into the same issue, and for my case it was bc that I was using torch==1.9.0. Downgrading it to 1.8.0 fixed the problem. Thanks!

GaParmar commented 2 years ago

Hi @hangg7

Thanks for pointing this out! This issue is related to this PyTorch JIT issue https://github.com/pytorch/pytorch/issues/64062 I will update the clean-fid with a temporary fix for this soon.

Regards, Gaurav

GaParmar commented 2 years ago

This issue should be resolved in the current clean-fid version. Feel free to re-open it if you encounter this again.