ultralytics / yolov5

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

Cropping training images along with their respective annotations #13336

Open andualemw1 opened 7 hours ago

andualemw1 commented 7 hours ago

Search before asking

Question

As we know, YOLO supports both square and rectangular images. However, for speed and dataset size considerations, I want to crop an image from 1280x1280 to 640x640. YOLO annotations/labels are originally created based on the image’s width and height. How can I bridge the gap in training the dataset before and after cropping the image while keeping the annotations unchanged?

thanks in advance!

Additional

No response

UltralyticsAssistant commented 7 hours ago

👋 Hello @andualemw1, thank you for your interest in YOLOv5 🚀! An Ultralytics engineer will assist you soon.

To get started with cropping images while retaining annotations, you might find our ⭐️ Tutorials helpful. You can explore guides for tasks such as Custom Data Training where managing image sizes and annotations is discussed.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

For custom training questions, provide as much information as possible, including dataset image examples and training logs. Verify you are following our Tips for Best Training Results.

Requirements

Ensure you have Python>=3.8.0 with all requirements.txt installed, including PyTorch>=1.8. To get started, run:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 can be run in verified environments, including:

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export, and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

Explore our latest object detection model, YOLOv8 🚀! Designed for speed and accuracy, perfect for a wide range of tasks. Discover more in our YOLOv8 Docs and get started with:

pip install ultralytics

Feel free to provide further details to help us address your question! 🔍