songweige / content-debiased-fvd

[CVPR 2024] On the Content Bias in Fréchet Video Distance
https://content-debiased-fvd.github.io/
MIT License
73 stars 3 forks source link

FVD seems not normal #4

Closed Alienge closed 1 month ago

Alienge commented 1 month ago

Nice Repo! I use this Repo to calculate the FVD from generating FFS dataset. But the FVD seems not normal! Any advices? I use the following code to calculate.

evaluator = fvd.cdfvd('videomae', ckpt_path=None)
evaluator.load_videos('ffs', data_type='stats_pkl', resolution=256, sequence_length=16)
evaluator.compute_fake_stats(evaluator.load_videos('./test/',data_type="video_folder"))
score = evaluator.compute_fvd_from_stats()
print(score)

The result is -1.9188070608923394e+28

songweige commented 1 month ago

Hi @Alienge, how many samples did you use to compute the FVD?

It seems that there is a numerical error where it could happen in the covariance matric inversion step as it didn't get even samples.

Alienge commented 1 month ago

I use the 2048 samples to compute the FVD. I also use the "i3d", it seems normal. I had check the value from scripts, abnormal seems come from $sqrt(cov1*cov2)$ code

Alienge commented 1 month ago

Hi @Alienge, how many samples did you use to compute the FVD?

It seems that there is a numerical error where it could happen in the covariance matric inversion step as it didn't get even samples.

Solution: change scipy == 1.12.0 to scipy ==1.10.0.

songweige commented 1 month ago

Thank you for digging into this and sharing what you found!!

I suspect this was because of a loose check in real->complex conversion for Schur decomposition, which only happens in 1.12.0:

https://github.com/scipy/scipy/commit/4751485b2996d8717af17d225091428d543acab3

It seems that they have improved this in the latest version 1.14.0.

https://github.com/scipy/scipy/commit/f56fe87a163cd1de957c2b891f265122fa3bbd41

I couldn't reproduce this error on my end. Would it be easy for you to test `1.14.0' as well? Thanks!! If it still causes an issue, we might want to switch to some more robust matrix square root function.

Alienge commented 1 month ago

I also test "scipy==1.14.0". It not appear the abnormal number. This problem is only happened in "scipy==1.12.0". If U want to test, I will upload the origin data to Google Drive to reproduce this problem.