face-vid2vid icon indicating copy to clipboard operation
face-vid2vid copied to clipboard

Keypoint prior loss function

Open hanweikung opened this issue 3 years ago • 2 comments

Thank you for your work. May I ask why your keypoint prior loss function is slightly different from the one in the original paper?

In the paper (A.2), the keypoint prior loss function is:

Screenshot from 2021-12-16 16-02-13

However, yours in losses.py is:

loss = (
    torch.max(0 * dist_mat, self.Dt - dist_mat).sum((1, 2)).mean()
    + torch.abs(kp_d[:, :, 2].mean(1) - self.zt).mean()
    - kp_d.shape[1] * self.Dt
)

I was wondering why you subtracted kp_d.shape[1] * self.Dt in the end.

hanweikung avatar Dec 16 '21 08:12 hanweikung

For the distance matrix dist_mat, its diagonal is zero. So self.Dt - dist_mat produced many self.Dt in its diagonal, which are summed into the loss and need to be thrown away.

zhengkw18 avatar Dec 16 '21 08:12 zhengkw18

I see now. Thank you for your prompt answer!

hanweikung avatar Dec 16 '21 08:12 hanweikung