ultralytics / yolov5

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

Training on different img-size dataset #9708

Closed ljz1998zzzz closed 2 years ago

ljz1998zzzz commented 2 years ago

Search before asking

Question

Question: Hello, may I ask if there is a way that I could train yolov5 on a dataset with different image size? If I could do that, will this make my model difficult to converge?

Background: For details, I have an image dataset with different sizes, and I don't want to change my images to the same size, like 640. That's because I want my model is capable of distinguishing the aspect ratio of the object. If I change the image size, then the aspect ratio of object will be changed too, which is against my wish. Of course, I will ensure the sizes of image meet the requirement of model's stride. So does this idea make sense? I would be grateful if you can give me any advice or idea. Many thanks.

Additional

No response

glenn-jocher commented 2 years ago

@ljz1998zzzz yes you can train on datasets of mixed image sizes, there is no problem. All images are resized to mosaics of image size --imgsz automatically during training.

ljz1998zzzz commented 2 years ago

@glenn-jocher I get it now. Thanks a lot.

glenn-jocher commented 11 months ago

@ljz1998zzzz you're welcome! Happy to help. If you have any more questions, feel free to ask. Keep up the great work!