Skip to content

Fix camera type dispatch in 3D demos#3144

Open
ziyangwang007 wants to merge 1 commit into
open-mmlab:dev-1.xfrom
ziyangwang007:fix-cam-type-dispatch
Open

Fix camera type dispatch in 3D demos#3144
ziyangwang007 wants to merge 1 commit into
open-mmlab:dev-1.xfrom
ziyangwang007:fix-cam-type-dispatch

Conversation

@ziyangwang007
Copy link
Copy Markdown

Motivation

The --cam-type argument in mono_det_demo.py and
multi_modality_demo.py is currently removed from call_args before calling
the inferencer. As a result, the user-provided camera type is not propagated to
the preprocessing stage.

In addition, Base3DInferencer._dispatch_kwargs consumes cam_type but only
uses it to set cam_type_dir. It does not dispatch cam_type back to
preprocess_kwargs, so Base3DInferencer.__call__ falls back to the default
CAM2.

This can cause demo failures such as KeyError: 'CAM2' even when users pass
a valid camera type like CAM0, CAM_BACK, or CAM_FRONT.

Fixes #2881.
Fixes #2868.
Related to #2981.

Modification

  • Keep cam_type in call_args in demo/mono_det_demo.py.
  • Keep cam_type in call_args in demo/multi_modality_demo.py.
  • Dispatch cam_type to preprocess kwargs in
    Base3DInferencer._dispatch_kwargs.
  • Continue using the same cam_type value for cam_type_dir, so saved
    visualization directories remain consistent with the selected camera.

BC-breaking (Optional)

No backward-incompatible change is expected. The change makes the existing
--cam-type argument take effect as intended.

Use cases (Optional)

This fixes demo commands that explicitly specify a camera type, for example:

python demo/multi_modality_demo.py \
  demo/data/sunrgbd/000017.bin \
  demo/data/sunrgbd/000017.jpg \
  demo/data/sunrgbd/sunrgbd_000017_infos.pkl \
  configs/imvotenet/imvotenet_stage2_8xb16_sunrgbd-3d.py \
  checkpoints/imvotenet_stage2_16x8_sunrgbd-3d-10class_20210819_192851-1bcd1b97.pth \
  --cam-type CAM0

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants