Skip to content
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

Fixed channel order RGB bug in the inference Code #11624

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

Conversation

SarmadNR
Copy link

@SarmadNR SarmadNR commented Apr 9, 2024

Motivation

The inference section of the tutorial jupyter notebook takes the input image as RGB. This affects the performance of the detector as the detector is trained with BGR format. This effect is not apparent in the provided ballon dataset but can have a huge impact depending on the dataset.

Modification

RGB bug in the inference Code is fixed by creating another variable for image. The model is then sent the image in BGR format and the visualizer is sent the image in RGB format.
import mmcv from mmdet.apis import init_detector, inference_detector img = mmcv.imread('./ballondatasets/balloon/train/7178882742_f090f3ce56_k.jpg',channel_order='rgb') img_bgr = mmcv.imread('./ballondatasets/balloon/train/7178882742_f090f3ce56_k.jpg',channel_order='bgr') checkpoint_file = 'tutorial_exps/epoch_12.pth' model = init_detector(cfg, checkpoint_file, device='cpu') new_result = inference_detector(model, img_bgr) print(new_result)

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
No sure

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 MMPreTrain.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

The inference section of the tutorial jupyter notebook takes the input image as RGB. This has effect on the performance of the detector as the detector is trained with BGR format. This effect is not apparent in the provided ballon dataset but can have a huge impact depending on the dataset.
@CLAassistant
Copy link

CLAassistant commented Apr 9, 2024

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

None yet

3 participants