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

Classifier - CutMix: Regularization Strategy to Train Strong Classifiers #4419

Closed
AlexeyAB opened this issue Nov 30, 2019 · 12 comments
Closed

Comments

@AlexeyAB
Copy link
Owner

AlexeyAB commented Nov 30, 2019

CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features

Use for Classifier training:

  • cutmix=1 - will be used CutMix (36%-91%, 9%-64%)
  • mixup=1 - will be used MixUp (50%, 50%)

Run training with flag -show_imgs to see how images are changed (in separate windows and saved to files aug_... .jpg) and how labels are changed (see the console).

./darknet classifier train cfg/imagenet1k_c.data cfg/efficientnet_b0.cfg -topk -show_imgs


img1


Results of ResNet50-Faster-RCNN: clovaai/CutMix-PyTorch#13

Backbone mAP
Baseline 33.27
Mixup-Pretrained 34.18
Cutout-Pretrained 34.28
CutMix-Pretrained 35.16

CutMix-Pretrained shows a meaningful improvement in MS-COCO detection!

@AlexeyAB
Copy link
Owner Author

AlexeyAB commented Dec 1, 2019

@WongKinYiu

Fixed CutMix: 4c26117
removed boundary-aware constraint: clovaai/CutMix-PyTorch#14

No, our code does not sample the cropping region with any boundary-aware constraint.

Use -show_imgs flag to see how does it work.
darknet.exe classifier train cfg/imagenet1k_c.data cfg/efficientnet_b0.cfg -topk -show_imgs

@WongKinYiu
Copy link
Collaborator

@AlexeyAB OK, I will re-train the models.

@WongKinYiu
Copy link
Collaborator

@AlexeyAB cutmix=1 gets Segmentation fault (core dump) in latest repo.

@AlexeyAB
Copy link
Owner Author

AlexeyAB commented Dec 5, 2019

@WongKinYiu After how many iterations it leads to Segmentation fault?
Did you use only cutmix=1 or together with mixup=1 mosaic=1?

@WongKinYiu
Copy link
Collaborator

@AlexeyAB 0~2 iterations, use together.

@AlexeyAB
Copy link
Owner Author

AlexeyAB commented Dec 5, 2019

@WongKinYiu
I tried cutmix=1 and cutmix=1 mosaic=1 but I can't reproduce this bug.

@WongKinYiu
Copy link
Collaborator

I used yesterday's repo and trained a detector.

@AlexeyAB
Copy link
Owner Author

AlexeyAB commented Dec 5, 2019

@WongKinYiu Detector doesn't support CutMix yet:
I added assert yesterday: efc5478#diff-2ceac7e68fdac00b370188285ab286f7R891

@WongKinYiu
Copy link
Collaborator

@AlexeyAB OK, thank you!

@WongKinYiu
Copy link
Collaborator

@AlexeyAB

mixup does not get better performance in my experiments but cutmix does, for example:

Model Augmentation Top-1 Top-5
CSPResNeXt-50 Normal 77.9 94.0
CSPResNeXt-50 Mixup 77.2 94.0
CSPResNeXt-50 Cutmix 78.0 94.3
CSPResNeXt-50 Cutmix+Mixup 77.7 94.4

@AlexeyAB
Copy link
Owner Author

@WongKinYiu Thanks! Did you test mosaic and cutmix+mosaic?

@WongKinYiu
Copy link
Collaborator

WongKinYiu commented Dec 14, 2019

@AlexeyAB

Not yet, I just get some available gpus today.

I will test mosaic=1 and blur=1 first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants