-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
Fix RGB Albumentations order #8747
Conversation
Seems like it's working. The only thing I'm worried about is non-contiguous images being passed around the dataloader. I'll check to see if they're contiguous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :)
@glenn-jocher But what does that have to do with the changes here? Or do you mean they could become noncontinous because of the changes? |
@UnglvKitDe ops on non-contiguous arrays will still run but they are no longer optimized and the operations may be much slower, i.e.: import cv2
import numpy
im_bgr = cv2.imread('data/images/bus.jpg')
im_rgb1 = im_bgr[...,::-1]
im_rgb2 = cv2.cvtColor(im_bgr, cv2.COLOR_BGR2RGB)
print(im_bgr.data.contiguous) # True
print(im_rgb1.data.contiguous) # False
print(im_rgb2.data.contiguous) # True |
Mh ok, thats a good point. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions YOLOv5 π and Vision AI β. |
π Hello there! We wanted to let you know that we've decided to close this pull request due to inactivity. We appreciate the effort you put into contributing to our project, but unfortunately, not all contributions are suitable or aligned with our product roadmap. We hope you understand our decision, and please don't let it discourage you from contributing to open source projects in the future. We value all of our community members and their contributions, and we encourage you to keep exploring new projects and ways to get involved. For additional resources and information, please see the links below:
Thank you for your contributions to YOLO π and Vision AI β |
@UnglvKitDe yes, it's important to ensure that the image arrays remain contiguous for performance reasons. The changes in the PR should not affect the contiguity of the arrays, but it's always good to verify that such issues don't arise with modifications to image handling. If you encounter any performance issues or have further questions, feel free to reach out. Thanks for your contribution! π |
Second attempt at resolving RGB Albmentations order issue #8695.
First PR fix #8695 failed and reverted.
π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Improved color handling in image augmentations and loading by ensuring consistent RGB color space usage.
π Key Changes
cv2.COLOR_BGR2HSV
tocv2.COLOR_RGB2HSV
inaugment_hsv()
to start with RGB images for HSV conversion.cv2.COLOR_HSV2BGR
tocv2.COLOR_HSV2RGB
after HSV operations to maintain images in RGB format.transpose
operation in__getitem__()
indataloaders.py
.load_image()
andcache_images_to_disk
to indicate that images are kept in RGB.π― Purpose & Impact