Closed DP1701 closed 2 years ago
@DP1701 π 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.
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.yaml
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 π 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:
Good luck π and let us know if you have any other questions!
@glenn-jocher Thank you for the detailed explanation. This helps!
However, I still have a question: What do the values (fraction) for HSV-Hue, HSV-Saturation and HSV-Value augmentation mean? Unfortunately, I have not yet found an answer to this question.
@DP1701 these are fractional gains on each of the image HSV channels. The augmentation function in here: https://github.com/ultralytics/yolov5/blob/4c409332667477560200958b513b958bb8fdef71/utils/augmentations.py#L47-L61
@glenn-jocher Thank you for the explanation and the hint.
I have another question about focal loss. In the hyperparameterset I can change the gamma value, but where can I set the alpha values?
@DP1701 Focal Loss function with alpha
is here:
https://github.com/ultralytics/yolov5/blob/9bc72a3ac2253b96b006baaacf099ca4ace31a61/utils/loss.py#L35-L63
@glenn-jocher Ok, if I set the gamma value in the hyperparameterset to 0, then the default value of 1.5 is set to 0. But I have to change the alpha value directly in the function in line 37?
@DP1701 yes you just update alpha in the code if you want, it's not a hyperparameter.
@glenn-jocher Thanks for the clarification.
I have an unbalanced data set. So the option I think will help to compensate this. Or is there another better option?
Hi @glenn-jocher thanks for the explanations. I have two question
@Akshaysharma29 yes, probability is 1.0
@glenn-jocher thanks for the responseπ. what should I do if I only required 0,90,180 rotation, not any other rotation? any suggestion?
@Akshaysharma29 uncomment L145 here: https://github.com/ultralytics/yolov5/blob/07221f1591c0ce7544bd5abf343dac2987e1614e/utils/augmentations.py#L142-L149
π Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 π resources:
Access additional Ultralytics β‘ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 π and Vision AI β!
Search before asking
Question
Hello all, is it possible to see how many images the dataset has grown by after the augmentation process?
Additional
No response