-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add fix for albu channel order #9981
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
base: dev
Are you sure you want to change the base?
Add fix for albu channel order #9981
Conversation
@@ -1484,8 +1484,14 @@ def __call__(self, results): | |||
else: | |||
results['masks'] = [mask for mask in results['masks'].masks] | |||
|
|||
# Convert to RGB since Albumentations works with RGB images | |||
results['image'] = cv2.cvtColor(results['image'], cv2.COLOR_BGR2RGB) |
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.
This fixing may have some potential errors.
As show in Loading Image:
channel_order='bgr', |
The image may be rgb, and this option may convert the image to BGR?
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.
Should I add a channel_order
parameter as in the loading init?
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.
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.
sorry for the late reply, we need to discuss it. Kindly ping @RangiLyu and @hhaAndroid have a look
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.
@RangiLyu @hhaAndroid @BIGWangYuDong any new?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #9981 +/- ##
==========================================
- Coverage 64.46% 64.41% -0.05%
==========================================
Files 370 370
Lines 30037 30039 +2
Branches 5008 5008
==========================================
- Hits 19363 19350 -13
- Misses 9638 9652 +14
- Partials 1036 1037 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Motivation
Albumentations uses RGB channel order. MMLab is based on BGR. It is necessary to sort channels properly before calling albu methods.
see #9891
Modification
Change channel order and add regression test.
BC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
Checklist