-
Notifications
You must be signed in to change notification settings - Fork 159
Description
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.