ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.57k stars 16.31k forks source link

does the training size affect the result? #9995

Closed alicera closed 1 year ago

alicera commented 2 years ago

Search before asking

Question

Assume my dataset size is (416,640) h,w

train with (640,640) and train with (416,640) Do you think which is better?

I know yolov5 use mosaic to train and validation the result with center padding. So the valid size is near (416,640). not (640,640). Because (640,640) can't effectively extend the image. It has many black information on image.

Additional

No response

glenn-jocher commented 2 years ago

@alicera I'd always train with the square images so the mosaics can do their work, you'll get better results that way.

alicera commented 2 years ago

Do you think is the mosaic suitable for rectangle images training?

glenn-jocher commented 2 years ago

@alicera no, they are exclusive, you can either do mosaics or --rect without mosaics

alicera commented 2 years ago

What is the limit for --rect without "mosaics"?
I only know the possible reason is that
H>W images are not suitable for rectangular training (like training size(416,640) ).
H>W images will cause many padding information for training size(416,640) with "mosaic"

Due to the above reason, the mosaic isn't suitable for rectangular

github-actions[bot] commented 1 year ago

👋 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 ⭐!

glenn-jocher commented 11 months ago

@alicera Generally speaking, it's recommended to use mosaics for good results with YOLOv5, but you can try without mosaics up to a point. Rectangular images with H > W may require excessive padding and might not perform as well. Try different approaches and see what works best for your specific use case. Good luck!