Closed oguiza closed 5 years ago
@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.
@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!
We updated train.py
.
https://github.com/clovaai/CutMix-PyTorch/blob/master/train.py#L240
Close issue.
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.