ultralytics / yolov5

YOLOv5 ๐Ÿš€ in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.21k stars 16.21k forks source link

mosaic augmentation #1423

Closed joe660 closed 3 years ago

joe660 commented 3 years ago

โ”Question

Hello, use your own data set to train on yolov5. For some reasons, you need to turn off mosaic augmentation to get some important information. May I ask how much the removal of mosaic augmentation affects the performance of the model.

Additional context

Hello, use your own data set to train on yolov5. For some reasons, you need to turn off mosaic augmentation to get some important information. May I ask how much the removal of mosaic augmentation affects the performance of the model.

github-actions[bot] commented 3 years ago

Hello @joe660, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

For more information please visit https://www.ultralytics.com.

github-actions[bot] commented 3 years ago

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.

AzharSindhi commented 3 years ago

I think this is a good question, anyone has some insights?

glenn-jocher commented 3 years ago

@AzharSindhi in general training will perform worse without mosaic augmentation. Recommend you train with all default settings, including default mosaic setting.

alevangel commented 3 years ago

I would like to remove the mosaic augmentation, also the scaling augmentation. How can I do that?

glenn-jocher commented 3 years ago

@alevangel you can modify hyperparameters in your hyperparameters file: https://github.com/ultralytics/yolov5/blob/e96c74b5a1c4a27934c5d8ad52cde778af248ed8/data/hyps/hyp.scratch.yaml#L1-L34

Tautvydas-byte commented 2 years ago

Hello, How to check how much new images were created and gave to the model after augmentation ? For example I give 117 images and using default mosaic augmentation with default hyper-params.

glenn-jocher commented 2 years ago

@Tautvydas-byte ๐Ÿ‘‹ Hello! Thanks for asking about image augmentation. YOLOv5 ๐Ÿš€ applies online imagespace and colorspace augmentations in the trainloader (but not the val_loader) to present a new and unique augmented Mosaic (original image + 3 random images) each time an image is loaded for training. Images are never presented twice in the same way.

YOLOv5 augmentation

Augmentation Hyperparameters

The hyperparameters used to define these augmentations are in your hyperparameter file (default data/hyp.scratch.yaml) defined when training:

python train.py --hyp hyp.scratch-low.yaml

https://github.com/ultralytics/yolov5/blob/b94b59e199047aa8bf2cdd4401ae9f5f42b929e6/data/hyps/hyp.scratch-low.yaml#L6-L34

Augmentation Previews

You can view the effect of your augmentation policy in your train_batch*.jpg images once training starts. These images will be in your train logging directory, typically yolov5/runs/train/exp:

train_batch0.jpg shows train batch 0 mosaics and labels:

YOLOv5 Albumentations Integration

YOLOv5 ๐Ÿš€ is now fully integrated with Albumentations, a popular open-source image augmentation package. Now you can train the world's best Vision AI models even better with custom Albumentations ๐Ÿ˜ƒ!

PR https://github.com/ultralytics/yolov5/pull/3882 implements this integration, which will automatically apply Albumentations transforms during YOLOv5 training if albumentations>=1.0.3 is installed in your environment. See https://github.com/ultralytics/yolov5/pull/3882 for full details.

Example train_batch0.jpg on COCO128 dataset with Blur, MedianBlur and ToGray. See the YOLOv5 Notebooks to reproduce: Open In Colab Open In Kaggle

Good luck ๐Ÿ€ and let us know if you have any other questions!

Tautvydas-byte commented 2 years ago

Thank you, for your fast answer. Speaking about augmentation what we see in the mosaic. Only these what we can see for example in the train_batch0.jpg is giving to model for every epoch or mosaic is changing in every epoch?

glenn-jocher commented 2 years ago

@Tautvydas-byte there's no such thing as two identical mosaics during training.