deepinsight / deepinsight/insightface

Why is logic of ArcFace in the losses.py file different from the research paper?

Open
#2,026 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
29.7k
Forks
6.1k
PR merge metrics
No merged PRs in 30d

Description

In the [forward function](https://github.com/deepinsight/insightface/blob/e78eee59caff3515a4db467976cf6293aba55035/recognition/arcface_torch/losses.py#L76), we have the following logic -

``` Python
if self.easy_margin:
final_target_logit = torch.where(target_logit > 0, cos_theta_m, target_logit)
else:
final_target_logit = torch.where(target_logit > self.theta, cos_theta_m, target_logit - self.sinmm)
```

From what I understand, this logic is meant to calculate the final_target_logit that is used to compute the loss function. I have two questions here -
1. Why was this conditional statement added in the code when there is no mention of this logic in the research paper.
2. What is the logic behind calculating `self.sinmm` and `self.theta`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.