-
Notifications
You must be signed in to change notification settings - Fork 666
Add sub center arcface loss #424
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
Add sub center arcface loss #424
Conversation
Thanks for starting this! I think sub-center arcface would be a great addition to the library. Is your implementation complete? |
@KevinMusgrave not yet, I believe I need to implement a function that would return dominant centers (our of subcenters) for data cleaning as stated in the paper. I am thinking of how I can integrate it neatly. I will try to finish it soon! |
Hi Chingis, thanks for your contribution on implementing Sub-center Arcface loss. Additionally, what do you think about adding dynamic margins for ArcFace loss as introduced in: Google Landmark Recognition 2020 Competition Third Place Solution |
@samils7 Thanks for bringing up dynamic margin. It looks interesting and straightforward to implement. I've created an issue for this feature. |
@KevinMusgrave Hello, I tried to implement a method to predict outliers (noise) and dominant centers and integrate it neatly with your library. Sub center Arcface is quite unique, so please take a look at my implementation and an example notebook with MNIST dataset. Let me know if there is anything I can change and improve for you! |
@samils7 thank you. I think it's almost done. I might just need to do some cleaning/refactoring. Feel free to share your ideas regarding my implementation. |
Thanks @chingisooinar! Can you add a test for this new loss function?
In case you're unfamiliar with the pytorch-metric-learning/tests/utils/test_common_functions.py Lines 49 to 56 in 0caae7a
You can run your test at the command line:
|
@KevinMusgrave hello I am sorry but I am having some troubles with relative imports in python scripts. |
I run the following command while in the root folder, and it works:
(I get a different import error, which is that ArcFaceLoss isn't in large_margin_softmax_loss.py.) |
@KevinMusgrave thank you for your hints. I implemented some unit tests and fixed my mistakes. Please take a look and let me know if there's anything I can do for you! |
…of torch.mm. Test multiple thresholds in corresponding test
Thanks @chingisooinar! The only major change I made was that I removed the "normalize" option from get_outliers, and I made the returned dominant centers unnormalized instead of normalized. |
Hello,
I am implementing Sub-center Arcface loss for this project according to the following paper
https://www.ecva.net/papers/eccv_2020/papers_ECCV/papers/123560715.pdf
I also added a notebook as an example with MNIST dataset. I am planning to implement a function to clean a dataset using dominant centers as stated in the paper. However, I am not sure what would be the best way to do it. If you would like to see Sub-center arcface in this repo as well, let me know what you think please. If there's anything you want me to change, please let me know as well!