mseitzer / pytorch-fid

Compute FID scores with PyTorch.
Apache License 2.0
3.22k stars 497 forks source link

What's the logic of this line code?HELP #79

Closed RSMung closed 2 years ago

RSMung commented 2 years ago

https://github.com/mseitzer/pytorch-fid/blob/3d604a25516746c3a4a5548c8610e99010b2c819/src/pytorch_fid/fid_score.py#L195 Why you want to check the elements in diagonal of covmean with 0? As far as I'm concerned, we just need to save the real value with this code: covmean = covmean.real so that we don't need to check it. Plz help me, thanks.

mseitzer commented 2 years ago

It checks that the square root of the product of covariances does not have a large imaginary component. If this is the case, something is wrong with the covariances (not positive definite) and you can not trust the results. This is why the check is necessary.