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

True lambda #1

Closed
oguiza opened this issue Jul 15, 2019 · 3 comments
Closed

True lambda #1

oguiza opened this issue Jul 15, 2019 · 3 comments
Labels
good first issue Good for newcomers

Comments

@oguiza
Copy link

oguiza commented Jul 15, 2019

There is a potential bug in the cutmix code when applying the lambda value to the target.
Initially you randomly define a lambda value that you use in the rand_bbox to define bbx1, bby1, bbx2, bby2. But when the coordinates of the selected region fall close to an image edge, the values are clipped. That's ok to define the image region (doing so all image pixels have the same probability of being selected). However, the true lambda (proportion of the image that is mixed) is smaller than the previously defined lambda.
To avoid this the true lambda value that should be applied to the target should be calculated this way:
lam = 1 - ((bbx2 - bbx1) * (bby2 - bby1) / (input.size()[-1] * input.size()[-2]))
This value would now be correctly, and can be applied to the target thus avoiding unnecessary distortions.

@hellbell hellbell added help wanted Extra attention is needed need test and removed help wanted Extra attention is needed labels Jul 16, 2019
@hellbell
Copy link
Collaborator

@oguiza
Yeah right, I ignored that 'boundary effect' and I forget to fix it. Thank you for reminding me.
I guess this modification cannot change the performance much.
Your corrected lambda computation seems to be right, so please send me PR.
If you can test with your corrected lambda computation, let me know when your test is done and there is no error.
If you don't have much resources to train, I will train and test with your code.
It might take a week.
Thanks.

@hellbell hellbell added the good first issue Good for newcomers label Jul 17, 2019
@hellbell
Copy link
Collaborator

hellbell commented Jul 31, 2019

@oguiza
We finished training with your true lambda version, and we got the results as,

  CIFAR100 ImageNet
Top-1 error 14.65 21.20

The codes will be updated, thanks!

@hellbell
Copy link
Collaborator

hellbell commented Aug 2, 2019

We updated train.py.
https://github.com/clovaai/CutMix-PyTorch/blob/master/train.py#L240

Close issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants