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

About mask2 in cifp_margin #4

Open
yiminglin-ai opened this issue Sep 14, 2023 · 4 comments
Open

About mask2 in cifp_margin #4

yiminglin-ai opened this issue Sep 14, 2023 · 4 comments

Comments

@yiminglin-ai
Copy link

Hello, why in CIFP margin did you consider only neg_logits that are smaller than pos_logits - self.m? Why those largerneg_logits should not be penalised? Thanks.

MixFairFace/network.py

Lines 29 to 30 in 11691d3

mask2 = (pos_logits - self.m) > neg_logits
topk_mask = topk_mask * mask2

@fuenwang
Copy link
Owner

This part is modified from official CIFP code (https://github.com/Tencent/TFace/blob/99cc558fde0176f38ff051155b110bfd7f6cdb3a/recognition/torchkit/head/localfc/cifp.py#L12)

I don't know the reason either. But I have tried many experiments on CIFP, and the implementation can really work and improve accuracy.

@yiminglin-ai
Copy link
Author

Thanks Fu-En, your implementation is much more readable than the official code! Have you experimented without the mask2?

@fuenwang
Copy link
Owner

I guess so. Because I had removed the official code line-by-line to check the corresponding performance, and my network.py only keeps the necessary parts to improve performance.

@yiminglin-ai
Copy link
Author

I see. My assumption is that the high neg_logits may be due to label errors, such as images with incorrect ID labels. Therefore, CIFP avoids using these neg_logits exclude these errors. They can be harmful especially towards the end of the training process.

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