Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you explain What easy_margin means? #57

Open
kdh4672 opened this issue Aug 10, 2020 · 0 comments
Open

Can you explain What easy_margin means? #57

kdh4672 opened this issue Aug 10, 2020 · 0 comments

Comments

@kdh4672
Copy link

kdh4672 commented Aug 10, 2020

At forward of ArcMarginProduct.py
there is this code line:

    if self.easy_margin:
        phi = torch.where(cosine > 0, phi, cosine)
    else:
        phi = torch.where((cosine - self.th) > 0, phi, cosine - self.mm)

I understand if easy_margin is True, what operation is happening, but I can't understand What that line mean if easy_margin is False.

I understand easy_margin True like this:
if easy_margin True : if cosine(theta) is more than 90 degree, it doesn't add margin m and just use cosine(theta)

But when easy_margin False is too difficult to understand for me.

So can you explain what phi = torch.where((cosine - self.th) > 0, phi, cosine - self.mm) does mean?

reference:
self.th = math.cos(math.pi - m)
self.mm = math.sin(math.pi - m) * m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant