Skip to content

Can you explain What easy_margin means? #57

@kdh4672

Description

@kdh4672

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions