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

Did anyone train without mosaic augmentation ? #55

Closed
Libaishun opened this issue Jun 14, 2020 · 9 comments
Closed

Did anyone train without mosaic augmentation ? #55

Libaishun opened this issue Jun 14, 2020 · 9 comments
Labels

Comments

@Libaishun
Copy link

I tried training yolov5s without mosaic augmentation, the training time per epoch halved, I guess the mosaic process in dataloader take up time.
Compare to training with mosaic augmentation, I found the loss is much lower while mAP is worse, I have not trained to 300 epochs to see the final result, but I guess mosaic augmentation will make training converge fast and better?

@Libaishun
Copy link
Author

training@15 epoch: loss = 0.1544, mAP@0.5=0.267, mAP=0.1412. mAP far lower than mosaic training at same epoch

@glenn-jocher
Copy link
Member

@Libaishun you can use the --rect argument to force rectangular training, which will skip the mosaic dataloader, but still use all of the augmentation hyperparamaters.:

python train.py --rect

train_batch0

@Libaishun
Copy link
Author

@glenn-jocher yeah, the problem is: training for same epochs, the mAP of rectangular training is much lower than mosaic training.

@Libaishun
Copy link
Author

Does this mean the mosaic augmentation trick is the key for yolov5 models to achive such high mAP on COCO?

@Jacobsolawetz
Copy link
Contributor

Mosaic is very important for COCO because it helps the model learn to not overemphasize activations for large objects (addressing the well known small object problem in COCO).

I'm glad you raised this issue because mosaic can really hurt custom datasets where you only have small objects to learn from. For example in an aerial dataset, one might tile images in preprocessing to get closer to the objects. You don't want mosaic there because it will zoom you back out.

@TommyZihao
Copy link
Contributor

Mosaic is very important for COCO because it helps the model learn to not overemphasize activations for large objects (addressing the well known small object problem in COCO).

I'm glad you raised this issue because mosaic can really hurt custom datasets where you only have small objects to learn from. For example in an aerial dataset, one might tile images in preprocessing to get closer to the objects. You don't want mosaic there because it will zoom you back out.

Thank you! I learned a lot from your answer~

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@kalfasyan
Copy link

kalfasyan commented May 9, 2022

Does this mean the mosaic augmentation trick is the key for yolov5 models to achive such high mAP on COCO?

I feel like this very important issue was raised a long time ago but it hasn't been properly adressed. I also noticed a big drop in performance by removing mosaic augmentation.

Mosaic is very important for COCO because it helps the model learn to not overemphasize activations for large objects (addressing the well known small object problem in COCO).

I'm glad you raised this issue because mosaic can really hurt custom datasets where you only have small objects to learn from. For example in an aerial dataset, one might tile images in preprocessing to get closer to the objects. You don't want mosaic there because it will zoom you back out.

My dataset falls in the quoted category of small objects so it's a bit counter-intuitive how excluding mosaic can lead to worse results..

@glenn-jocher
Copy link
Member

@kalfasyan thank you for sharing your insights! The impact of mosaic augmentation can vary greatly depending on the dataset characteristics. Mosaic is indeed essential for addressing certain challenges in COCO, however, as you've observed, it can have different effects on custom datasets, particularly those with predominantly small objects. Your experience highlights the intricate interplay between augmentation strategies and dataset specifics, and I appreciate your contribution to the discussion!

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

No branches or pull requests

5 participants