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

What does this line in NPCFace mean? I didn't find it in the paper. #1

Open
marigoold opened this issue Mar 29, 2021 · 3 comments
Open

Comments

@marigoold
Copy link

final_gt= torch.where(gt > 0, cos_theta_m, gt) #gt>0即角度<90°

I didn't find it in the paper, and I don't know what it means.
In my opinion, gt < 0 means that the angle between positive case and its corresponding class weight center is large enough so there is no need to add margin, am I right?

@bobo0810
Copy link
Owner

bobo0810 commented Mar 29, 2021

final_gt= torch.where(gt > 0, cos_theta_m, gt) #gt>0即角度<90°

I didn't find it in the paper, and I don't know what it means.
In my opinion, gt < 0 means that the angle between positive case and its corresponding class weight center is large enough so there is no need to add margin, am I right?

I think so too. In the implementation of NPCFace, ArcFace is referred to, and the same measures are taken.

@marigoold
Copy link
Author

Thanks!
By the way, do you have plan to implement NPCFace in DDP like what insightface does? I tried to implement one but it didn't converge.
😭

@bobo0810
Copy link
Owner

Thanks!
By the way, do you have plan to implement NPCFace in DDP like what insightface does? I tried to implement one but it didn't converge.
😭

In my experiment, NPCFace works well under DP training. Maybe you first make sure to converge under DP?

Although I haven't tried DDP training, there should be no problem in theory. The following two suggestions:

  1. Since DDP runs a separate project code for each GPU, it only needs to control the tensor on the same device.
    For example, create a new tensor mi and move it to the same device as the input tensor.
    mi = torch.full([batch_size], self.m0).to(input.device)
  2. A recently implemented another version of NPCFace

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

2 participants