Closed UygarUsta99 closed 2 years ago
👋 Hello @UygarUsta99, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.
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 training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
For business inquiries or professional support requests please visit https://ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.
Python>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
@UygarUsta99 👋 Hello! Thanks for asking about image augmentation. scale=0.5
hyperparameter controls scale jitter. 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, I think he meant multi-scale training where you change the image size and not the scale augmentation. Just wanted to confirm. Thanks!
@ankur219 you can change image size with the --multi-scale arg (not recommended).
python train.py --multi-scale
https://github.com/ultralytics/yolov5/blob/0b5ac224aef287ac3ac9ebf70ade60159450a0b1/train.py#L468
@ankur219 you can change image size with the --multi-scale arg (not recommended).
python train.py --multi-scale
https://github.com/ultralytics/yolov5/blob/0b5ac224aef287ac3ac9ebf70ade60159450a0b1/train.py#L468
Why is not recommended?
worse results
@glenn-jocher Citing from a paper I've been reading: "Adjusting the input size during training was reported to improve object detection across different object scales [0]".
I might be missing something here but AFAIK the darknet implementation had an argument --random which did multi scale training the same idea you referenced above --multi-scale and the paper [0] reports that the results are improved this way. Did you mean that in practice you found this to be not true?
Also how was 50% chosen for this implementation in train.py? I see it is at
if opt.multi_scale:
sz = random.randrange(imgsz * 0.5, imgsz * 1.5 + gs) // gs * gs # size
sf = sz / max(imgs.shape[2:]) # scale factor
if sf != 1:
ns = [math.ceil(x * sf / gs) * gs for x in imgs.shape[2:]] # new shape (stretched to gs-multiple)
imgs = nn.functional.interpolate(imgs, size=ns, mode='bilinear', align_corners=False)
[0]: YOLO9000: Better, Faster, Stronger - https://arxiv.org/pdf/1612.08242.pdf, page 4, par 1
@ch-hristov YOLOv5 by default uses 50% scale jitter, which changes the scale of the image contents, you can modify with the scale hyp. --multi-scale will also change the actual image size, default is False.
Search before asking
Question
Like I have stated in the title,does yolov5 use multiscale training(at various image sizes) ? It is often stated that using multiscale training helps in detecting small objects besides training them with a fixed high resolution.Thanks for all the help.
Additional
No response