-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Bug] img_path = data_info['images'][cam_type]['img_path'] KeyError: 'CAM2' #2981
Comments
The cam-type is somehow failed to pass its value here. I add |
I solved it. Just as I posted before, some important parameters were missing. Some changes: # cam2img = np.asarray(
# data_info['images'][cam_type]['cam2img'], dtype=np.float32)
# lidar2cam = np.asarray(
# data_info['images'][cam_type]['lidar2cam'],
# dtype=np.float32)
# if 'lidar2img' in data_info['images'][cam_type]:
# lidar2img = np.asarray(
# data_info['images'][cam_type]['lidar2img'],
# dtype=np.float32)
# else:
# lidar2img = cam2img @ lidar2cam
# lidar2img = cam2img @ lidar2cam[0:3]
# for sunrgbd
cam2img = np.asarray([[574.334300, 0.000000, 320.000000, 0.000000],
[0.000000, 574.334300, 240.000000, 0.000000],
[0.000000, 0.000000, 1.000000, 0.000000],
[0.000000, 0.000000, 0.000000, 1.000000]]
)
lidar2cam = np.asarray(
[[0.999997, 0.002445, 0.000612, 0.000000],
[-0.002445, 0.881972, 0.471295, 0.000000],
[0.000612, -0.471295, 0.881975, 0.000000],
[0, 0, 0, 1]]
)
lidar2img = cam2img @ lidar2cam
input['cam2img'] = cam2img
input['lidar2cam'] = lidar2cam
input['lidar2img'] = lidar2img in depth2img = torch.tensor([[530.5366320782341, 362.0406589161139, -32.432176765054464], [35.10014939727262, 164.8833093419671, -567.605659916997], [0.005785000044852495, 0.9835000038146973, -0.18082000315189362]]).cuda()
# depth2img = xyz_depth.new_tensor(img_meta['depth2img']) |
Prerequisite
Task
I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
Branch
main branch https://github.com/open-mmlab/mmdetection3d
Environment
sys.platform: linux
Python: 3.8.19 (default, Mar 20 2024, 19:58:24) [GCC 11.2.0]
CUDA available: True
MUSA available: False
numpy_random_seed: 2147483648
GPU 0,1: NVIDIA GeForce RTX 4090 D
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 11.3, V11.3.109
GCC: gcc (Ubuntu 9.5.0-1ubuntu1~22.04) 9.5.0
PyTorch: 1.12.0+cu113
PyTorch compiling details: PyTorch built with:
TorchVision: 0.13.0+cu113
OpenCV: 4.9.0
MMEngine: 0.10.4
MMDetection: 3.1.0
MMDetection3D: 1.4.0+
spconv2.0: True
Reproduces the problem - code sample
python demo/mono_det_demo.py demo/data/nuscenes/n015-2018-07-24-11-22-45+0800__CAM_BACK__1532402927637525.jpg demo/data/nuscenes/n015-2018-07-24-11-22-45+0800.pkl configs/fcos3d/fcos3d_r101-caffe-dcn_fpn_head-gn_8xb2-1x_nus-mono3d_finetune.py ${CHECKPOINT_FILE} --show --cam-type CAM_BACK
Reproduces the problem - command or script
python demo/mono_det_demo.py demo/data/nuscenes/n015-2018-07-24-11-22-45+0800__CAM_BACK__1532402927637525.jpg demo/data/nuscenes/n015-2018-07-24-11-22-45+0800.pkl configs/fcos3d/fcos3d_r101-caffe-dcn_fpn_head-gn_8xb2-1x_nus-mono3d_finetune.py fcos3d_r101_caffe_fpn_gn-head_dcn_2x8_1x_nus-mono3d_finetune_20210717_095645-8d806dc2.pth --show --cam-type CAM_BACK
Reproduces the problem - error message
This may cause unexpected failure when running the built modules. Please check whether "mmdet3d" is a correct scope, or whether the registry is initialized.
/home/yuanyue2021/anaconda3/envs/mm3d/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.LocalVisBackend'>, please provide the
save_dir
argument.warnings.warn(f'Failed to add {vis_backend.class}, '
Traceback (most recent call last):
File "demo/mono_det_demo.py", line 98, in
main()
File "demo/mono_det_demo.py", line 88, in main
inferencer(**call_args)
File "/mnt/DataDiskA/yuanyue2021/MMDetection/mmdetection3d-new/mmdet3d/apis/inferencers/base_3d_inferencer.py", line 204, in call
ori_inputs = self._inputs_to_list(inputs, cam_type=cam_type)
File "/mnt/DataDiskA/yuanyue2021/MMDetection/mmdetection3d-new/mmdet3d/apis/inferencers/mono_det3d_inferencer.py", line 110, in _inputs_to_list
img_path = data_info['images'][cam_type]['img_path']
KeyError: 'CAM2'
Additional information
No response
The text was updated successfully, but these errors were encountered: