MCG-NKU / E2FGVI

Official code for "Towards An End-to-End Framework for Flow-Guided Video Inpainting" (CVPR2022)
Other
1.04k stars 100 forks source link

VFID calculation error #82

Closed LingyiHongfd closed 9 months ago

LingyiHongfd commented 10 months ago

Hello, thanks for your interesting and amazing work. When I run with your inference codes on DAVIS, I met with some problem about the calculation of metrics. I run the official codes through the following commands: python evaluate.py --model e2fgvi --dataset davis --data_root ./datasets --ckpt release_model/E2FGVI-CVPR22.pth

And I met some problems about the calculation of VFID. The error log is as followed: fid_score = calculate_vfid(real_i3d_activations, output_i3d_activations) File "./core/metrics.py", line 115, in calculate_vfid return calculate_frechet_distance(m1, s1, m2, s2) File "./core/metrics.py", line 164, in calculate_frechet_distance raise ValueError('Imaginary component {}'.format(m)) ValueError: Imaginary component 2.319157548072372e+74

Had you experimented similar error?

Paper99 commented 9 months ago

Hello, we have not encountered this kind of problem. You may need to check the installed requirements.

LingyiHongfd commented 9 months ago

Thanks for your reply. I have solved the problem by modifying the codes. And the following is the modified codes. It works for me and I can obtain the same VFID as the results in paper by your provided weights.

`

diff = mu1 - mu2
# Product might be almost singular
covmean, _ = linalg.sqrtm(sigma1.dot(sigma2), disp=False)
# if not np.isfinite(covmean).all():
#     msg = ('fid calculation produces singular product; '
#            'adding %s to diagonal of cov estimates') % eps
#     print(msg)
#     offset = np.eye(sigma1.shape[0]) * eps
#     covmean = linalg.sqrtm((sigma1 + offset).dot(sigma2 + offset))

sigma1 += np.eye(*sigma1.shape) * eps  
sigma2 += np.eye(*sigma2.shape) * eps  

# Product might be almost singular
covmean, _ = linalg.sqrtm(sigma1.dot(sigma2), disp=False)

# Numerical error might give slight imaginary component
if np.iscomplexobj(covmean):
    if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3):
        m = np.max(np.abs(covmean.imag))
        raise ValueError('Imaginary component {}'.format(m))
    covmean = covmean.real

`

LingyiHongfd commented 9 months ago

Hello, I have met with another problem about the evaluation of Ewarp. I have found that the origin codes of Ewarp depend on FlowNet2, and the environment dependency is too old. I can not compile the ops on my server. Besides, the official link of pertained weights is out-dated. I would appreciate it if you can provide more details about the evaluation of Ewarp.

Paper99 commented 9 months ago
  1. Try this link: https://github.com/NVIDIA/flownet2-pytorch
  2. Change the FlowNet2 to RAFT.
LingyiHongfd commented 9 months ago

Thanks a lot. I will try it!