maum-ai / faceshifter

Unofficial PyTorch Implementation for FaceShifter (https://arxiv.org/abs/1912.13457)
BSD 3-Clause "New" or "Revised" License
610 stars 114 forks source link

The implementation of ID Loss seems different from the original paper #19

Closed SystemErrorWang closed 3 years ago

SystemErrorWang commented 3 years ago

At first, thank you for your nice work, it helped me a lot! But when I was reading your code, I found a problem: in the original paper, id loss is calculated by the cos similarity, while in this implementation, it's calculated by bmm or inner product. Would like to know the reason why change cosine loss to bmm, and the influence on the final result. much appreciate it if you would reply.

SystemErrorWang commented 3 years ago

I changed the id loss to the cosine format, and this improved the model performance in my experiments.

usingcolor commented 3 years ago

Hi, the cosine similarity of two unit vectors is equal to the inner product. In my code, I used bmm to implement the inner product. I recommend you to read paper and code about Arcface, which faceshifter used for identity encoder.