Skip to content

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

mmeendez8
Copy link
Contributor

@mmeendez8 mmeendez8 commented Mar 17, 2023

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

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@ZwwWayne ZwwWayne changed the base branch from master to dev March 17, 2023 14:43
@@ -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)
Copy link
Collaborator

@BIGWangYuDong BIGWangYuDong Mar 18, 2023

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:

The image may be rgb, and this option may convert the image to BGR?

Copy link
Contributor Author

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.41%. Comparing base (e9cae2d) to head (f3298bd).
Report is 11 commits behind head on dev.

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     
Flag Coverage Δ
unittests 64.41% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants