Skip to content

Instantly share code, notes, and snippets.

@muety
Created December 16, 2024 14:42
Show Gist options
  • Save muety/a53bbc5c7d896cb4bd6f6a25f63d15b6 to your computer and use it in GitHub Desktop.
Save muety/a53bbc5c7d896cb4bd6f6a25f63d15b6 to your computer and use it in GitHub Desktop.
diff --git a/demo/mono_det_demo.py b/demo/mono_det_demo.py
index 42416fd9..0f4fcec9 100644
--- a/demo/mono_det_demo.py
+++ b/demo/mono_det_demo.py
@@ -56,8 +56,8 @@ def parse_args():
call_args = vars(parser.parse_args())
call_args['inputs'] = dict(
- img=call_args.pop('img'), infos=call_args.pop('infos'))
- call_args.pop('cam_type')
+ img=call_args.pop('img'), infos=call_args.pop('infos')
+ )
if call_args['no_save_vis'] and call_args['no_save_pred']:
call_args['out_dir'] = ''
diff --git a/mmdet3d/apis/inferencers/base_3d_inferencer.py b/mmdet3d/apis/inferencers/base_3d_inferencer.py
index 6564325e..e5cf56f0 100644
--- a/mmdet3d/apis/inferencers/base_3d_inferencer.py
+++ b/mmdet3d/apis/inferencers/base_3d_inferencer.py
@@ -168,6 +168,7 @@ class Base3DInferencer(BaseInferencer):
kwargs['pred_out_dir'] = out_dir
if cam_type != '':
kwargs['cam_type_dir'] = cam_type
+ kwargs['cam_type'] = cam_type
return super()._dispatch_kwargs(**kwargs)
def __call__(self,
diff --git a/mmdet3d/apis/inferencers/mono_det3d_inferencer.py b/mmdet3d/apis/inferencers/mono_det3d_inferencer.py
index 22863ae1..abbfab7f 100644
--- a/mmdet3d/apis/inferencers/mono_det3d_inferencer.py
+++ b/mmdet3d/apis/inferencers/mono_det3d_inferencer.py
@@ -107,25 +107,25 @@ class MonoDet3DInferencer(Base3DInferencer):
assert len(info_list) == len(inputs)
for index, input in enumerate(inputs):
data_info = info_list[index]
- img_path = data_info['images'][cam_type]['img_path']
- if isinstance(input['img'], str) and \
- osp.basename(img_path) != osp.basename(input['img']):
- raise ValueError(
- f'the info file of {img_path} is not provided.')
+ #img_path = data_info['images'][cam_type]['img_path']
+ #if isinstance(input['img'], str) and \
+ # osp.basename(img_path) != osp.basename(input['img']):
+ # raise ValueError(
+ # f'the info file of {img_path} is not provided.')
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
+ # 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
input['cam2img'] = cam2img
- input['lidar2cam'] = lidar2cam
- input['lidar2img'] = lidar2img
+ # input['lidar2cam'] = lidar2cam
+ # input['lidar2img'] = lidar2img
elif isinstance(inputs, (list, tuple)):
# get cam2img, lidar2cam and lidar2img from infos
for input in inputs:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment