-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Questions about mosaic and affine transformation data augmentation. #13030
Comments
👋 Hello @zhangtingyu11, 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 a minimum reproducible example to help us debug it. If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results. RequirementsPython>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf 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 🚀We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀! Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects. Check out our YOLOv8 Docs for details and get started with: pip install ultralytics |
@zhangtingyu11 hello! Great questions regarding the data augmentation techniques used in YOLOv5.
It might be helpful to review the parameters being used for transformations (like rotation, scaling, and translation values) to ensure they are within a reasonable range that preserves the integrity of the images. If the issue persists, consider adjusting these parameters slightly to see if it improves the output. For a deeper dive into the architecture and augmentation strategies, you might find the YOLOv5 architecture description helpful: https://docs.ultralytics.com/yolov5/tutorials/architecture_description/ Hope this helps clarify your queries! 😊 |
Thank you for your response. I have a question regarding the Is this behavior reasonable? I believe the image should contain enough information for effective model training. Would it be possible to use the minimum bounding rectangle that encompasses all four images, and then resize this rectangle to (640, 640)? I think this approach would retain more information compared to simple cropping, although resizing might affect the scale. I would appreciate your advice on this matter. |
Hello @zhangtingyu11! You've brought up a valid point regarding the handling of the concatenated image in the The current behavior where Your suggestion to use the minimum bounding rectangle to encompass all four images and then resize it to (640, 640) is an interesting approach. It could help in retaining more contextual information from each of the four images, although, as you mentioned, resizing could affect the scale and aspect ratio of objects within the images, which might influence how the model learns object proportions and spatial relationships. An alternative could be to adjust the affine transformation parameters to reduce the extent of translation and scaling, ensuring that more of each image is retained within the final 640x640 output. This approach would allow you to keep the current pipeline while minimizing information loss. Experimenting with these configurations and observing their impact on model performance (e.g., validation loss, detection accuracy) would be the best way to determine the most effective strategy. Each dataset might behave differently under these transformations, so tuning according to your specific use case is recommended. Hope this helps, and happy experimenting! 😊 |
Thank you for your advice! I will try these configurations and test their performance. |
You're welcome! I'm glad to hear you'll be experimenting with those configurations. If you have any more questions or need further assistance as you test, feel free to reach out. Happy coding and best of luck with your model tuning! 😊 |
Search before asking
Question
I have been examining the source code of the data augmentation in YOLOv5, which utilizes mosaic and affine transformations. The mosaic method concatenates four images into a single image. In the augmentations.pyfile , the height and width are set to 640. However, the height and width of the concatenated image are 1280 and 1280, respectively.
From my understanding, the following code indicates that the rotation and scale operations should be performed around the center point. Therefore, a translation matrix is used to move the source point to the image center.
The translation matrix is defined as follows:
Is the 0.5 deliberately set? In my opinion, the source point should be translated from the image center to the top left point, and 0.5 should be changed to 1 since
width
andheight
is only the half of the concatenated image dimensions.Additionally, I checked the image returned by the
__getitem__
function, shown below:Only the bottom right image is complete, while the other three are almost unrecognizable. Is this behavior consistent with the intended design?
Additional
No response
The text was updated successfully, but these errors were encountered: