toshas / torch-fidelity

High-fidelity performance metrics for generative models in PyTorch
Other
1.01k stars 66 forks source link

About the value of FID #44

Closed zy-charon closed 1 year ago

zy-charon commented 1 year ago

Hello, I would like to ask why I get a negative value when calculating FID with pictures in the same folder. Is this normal? image

toshas commented 1 year ago

Theoretically speaking, FID values are positive, but in this case (1) the distributions are the same, meaning we expect zero (2) the covariance will likely be singular or ill-conditioned, which may result in unstable computation. Numerical precision issues may arise in this case, which is normal. 5e-5 is a reasonable precision error with 32-bit floating-point computation, this is 2 to 4 orders of magnitude less than the typically-reported error bars in scientific papers.