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

Loss weighting #7

Closed
milliema opened this issue Feb 7, 2022 · 2 comments
Closed

Loss weighting #7

milliema opened this issue Feb 7, 2022 · 2 comments

Comments

@milliema
Copy link

milliema commented Feb 7, 2022

Hi!
I have a question for the loss re-weighting.
According to my understanding, image with higher k should be assigned a lower loss weight since it is easier to predict with more information disclosed. As in Fig. 3, cat image has area k, and dog image 1-k. The computed loss weight is w(1-k) for cat and w(k) for dog. The higher k, the higher w(k).
But in the code, it seems the computed weight w(k) is assiged to image with ratio k, other than the opposite.
I am wondering which one is correct? How to understand the difference here?

@alexrame
Copy link
Owner

alexrame commented Feb 7, 2022

Hello, thank you for your question.
It's the other way around: the main image (k>1/2) should be assigned more weight in classification than the other "minor" image (1-k<1/2). Generally, in mixup/cutmix papers, this weight is exactly the ratio k. We found that in MixMo, taking a "power-law" formulation works better to improve diversity. See more information in Appendix 6.1. And sorry if Fig 3 was misleading. So to sum up, the implementation is correct and consistent with what was described in the paper. Hope this helps.

@milliema
Copy link
Author

milliema commented Feb 8, 2022

Thanks for your prompt reply, the explanation is very hepful, now I'm pretty clear.
Regards!

@milliema milliema closed this as completed Feb 8, 2022
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