GaParmar / clean-fid

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

Questions regarding the KID score implementation #18

Open hubert0527 opened 2 years ago

hubert0527 commented 2 years ago

Hi,

Thanks for maintaining the library for GAN research! I noticed that the KID implementation in this repository is quite different from the official KID implementation Could the author explain a bit about the differences?

Best, Hubert

GaParmar commented 2 years ago

Hi Hubert,

Even though the implementations look different, they are computing the same function.

More specifically, KID is defined as the squared MMD distance where the kernel k(x,y) is standard polynomial kernel. (d is the dimension x, y).

In the official KID implementation you linked, this kernel is computed using the sklearn (from sklearn.metrics.pairwise import polynomial_kernel). However, in the implementation here, we compute it directly in PyTorch. The differences can be attributed to different code organization preferences.

Regards, Gaurav