HuangYG123 / CurricularFace

CurricularFace(CVPR2020)
MIT License
529 stars 72 forks source link

about class CurricularFace(nn.Module) #14

Closed zhushumin closed 4 years ago

zhushumin commented 4 years ago

In this loss, you choose the hard_example by "mask = cos_theta > cos_theta_m; " and " hard_example = cos_theta[mask]". However the cos_theta is always larger than cos_thata_m. This code is useless and it does not match your paper.

if cos(θyi + m) ≥ cosθj then N(t,cosθj) = cosθj; else N(t,cosθj) = (t(k) + cosθj)cosθj ;

HuangYG123 commented 4 years ago

cos_theta is the cosine similarity, and the shape is BxC. cos_theta_m is the target cosine similarity, and the shape is Bx1. The shape of mask is BxC. Why cos_theta is always larger than cos_thata_m?

zhushumin commented 4 years ago

Sorry, that's my fault. I misunderstand your code.