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

Does yolov5 has the data augmentation of flip horizontally ? #1185

Closed wwdok closed 3 years ago

wwdok commented 3 years ago

❔Question

I see some basic data augmentations in train.py, but i don't see flip horizontally and mosaic and so on, so does yolov5 support other more data augmentations ?

github-actions[bot] commented 3 years ago

Hello @wwdok, 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.

glenn-jocher commented 3 years ago

Augmentation hyperparameters are located here: https://github.com/ultralytics/yolov5/blob/83deec133d62021b496ba6cc475c38e717098053/data/hyp.scratch.yaml#L1-L33

wwdok commented 3 years ago

@glenn-jocher Sorry, i find my repo is out of date, the newest repo already has fliplr hypeparameter ! Thanks !

glenn-jocher commented 3 years ago

@wwdok ah, you should git pull often, as repo changes nightly.

wwdok commented 3 years ago

@wwdok ah, you should git pull often, as repo changes nightly.

Hi, bro, I find in the train.py of 3 months ago, there is mixed_precision, but now i find the latest train.py does not include mixed_precision, why was it cancelled ? image

glenn-jocher commented 3 years ago

@wwdok mixed precision is integrated by default now.

wwdok commented 3 years ago

@glenn-jocher Great ! πŸ˜€

LogicNg commented 3 years ago

So in every epochs the data will be augmented according to the probability?

glenn-jocher commented 3 years ago

@LogicNg yes every mosaic.

julian-douglas commented 3 years ago

I have a question about the augmentations. I don't understand how the HSV augmentations are generated. For example, we have: hsv_s: 0.7 # image HSV-Saturation augmentation (fraction)

What does this do? Is this changing the saturation to 70% of the original? Or is it Β± 70%, so 30% and 170%? Or is it a 0.7 probability that the saturation will change? If so, how much will it change by? Will it both increase and decrease? Will it affect every image?

Also, for the image rotations, if I put 90, will that be clockwise or anticlockwise?

Thank you

glenn-jocher commented 3 years ago

@julian-douglas augmentations are defined in your hyperparameter file and implemented in datasets.py. Albumentations may be added additionally, see Albumentations PR.

YOLOv5 augmentation

RainbowSun11Q2H commented 2 years ago

Thanks for your code.

Does the "degree" in hyperparameter files mean rotation augmentation? And what is the range of "degree"?

Thanks.

glenn-jocher commented 2 years ago

@RainbowSun11Q2H πŸ‘‹ Hello! Thanks for asking about image augmentation. degree limits are +/- 180

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!

Bara-Elba commented 2 years ago

Can I indicate how many images exactly to be generated. I have a small dataset and I want to augment it *10, I searched in the code and didn't find where to do it. is there a possibility to do so ?

glenn-jocher commented 2 years ago

@Bara-Elba πŸ‘‹ 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!