Arcface Code vs Paper Understanding #538
-
Hey guys! Good Day! Hope everyone's keeping well. I had one question regarding the computation of cosine of target logit in ArcFace loss. In the source-code for arcface loss, I found the following def modify_cosine_of_target_classes(self, cosine_of_target_classes):
angles = self.get_angles(cosine_of_target_classes)
return torch.cos(angles + self.margin) There is an addition of margin to the angle and then we compute the cosine. While this is alright for all cases where the feature embedding makes an angle less than final_target_logit = torch.where(target_logit > self.theta, cos_theta_m, target_logit - self.sinmm) This is to keep the loss function monotonically decreasing with respect to increasing angles between target center and the feature embedding. However, despite this change, pml's arcface gives decent results; any ideas on what is going on here or did I miss any code where you have added this check already? Thanks a lot, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The repo author has marked this as a bug and will be considered. Hence closing this discussion. Thanks Kevin! |
Beta Was this translation helpful? Give feedback.
The repo author has marked this as a bug and will be considered. Hence closing this discussion. Thanks Kevin!