Skip to content

Commit 12e2b7c

Browse files
[Enhance] Support LiDAR visualization (#2611)
* need fix multi_modality * update multi modal * remove pcd * fix mix bug * fix nusence_mini * fix msehframe * fix flag exit * add space line
1 parent 2c13673 commit 12e2b7c

File tree

7 files changed

+165
-49
lines changed

7 files changed

+165
-49
lines changed

configs/_base_/datasets/semantickitti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
dataset_type='semantickitti',
114114
backend_args=backend_args),
115115
dict(type='PointSegClassMapping'),
116-
dict(type='Pack3DDetInputs', keys=['points'])
116+
dict(type='Pack3DDetInputs', keys=['points', 'pts_semantic_mask'])
117117
]
118118
# construct a pipeline for data and gt loading in show function
119119
# please keep its loading function consistent with test_pipeline (e.g. client)

demo/mono_det_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def main(args):
5959
data_sample=result,
6060
draw_gt=False,
6161
show=args.show,
62-
wait_time=0,
62+
wait_time=-1,
6363
out_file=args.out_dir,
6464
pred_score_thr=args.score_thr,
6565
vis_task='mono_det')

demo/multi_modality_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def main(args):
6767
data_sample=result,
6868
draw_gt=False,
6969
show=args.show,
70-
wait_time=0,
70+
wait_time=-1,
7171
out_file=args.out_dir,
7272
pred_score_thr=args.score_thr,
7373
vis_task='multi-modality_det')

demo/pcd_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def main(args):
4949
data_sample=result,
5050
draw_gt=False,
5151
show=args.show,
52-
wait_time=0,
52+
wait_time=-1,
5353
out_file=args.out_dir,
5454
pred_score_thr=args.score_thr,
5555
vis_task='lidar_det')

demo/pcd_seg_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def main(args):
4545
data_sample=result,
4646
draw_gt=False,
4747
show=args.show,
48-
wait_time=0,
48+
wait_time=-1,
4949
out_file=args.out_dir,
5050
vis_task='lidar_seg')
5151

mmdet3d/engine/hooks/visualization_hook.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import numpy as np
88
from mmengine.fileio import get
99
from mmengine.hooks import Hook
10+
from mmengine.logging import print_log
1011
from mmengine.runner import Runner
1112
from mmengine.utils import mkdir_or_exist
1213
from mmengine.visualization import Visualizer
@@ -56,6 +57,8 @@ def __init__(self,
5657
vis_task: str = 'mono_det',
5758
wait_time: float = 0.,
5859
test_out_dir: Optional[str] = None,
60+
draw_gt: bool = True,
61+
draw_pred: bool = True,
5962
backend_args: Optional[dict] = None):
6063
self._visualizer: Visualizer = Visualizer.get_current_instance()
6164
self.interval = interval
@@ -70,11 +73,20 @@ def __init__(self,
7073
'needs to be excluded.')
7174
self.vis_task = vis_task
7275

76+
if wait_time == -1:
77+
print_log(
78+
'Manual control mode, press [Right] to next sample.',
79+
logger='current')
80+
else:
81+
print_log(
82+
'Autoplay mode, press [SPACE] to pause.', logger='current')
7383
self.wait_time = wait_time
7484
self.backend_args = backend_args
7585
self.draw = draw
7686
self.test_out_dir = test_out_dir
7787
self._test_index = 0
88+
self.draw_gt = draw_gt
89+
self.draw_pred = draw_pred
7890

7991
def after_val_iter(self, runner: Runner, batch_idx: int, data_batch: dict,
8092
outputs: Sequence[Det3DDataSample]) -> None:
@@ -208,6 +220,8 @@ def after_test_iter(self, runner: Runner, batch_idx: int, data_batch: dict,
208220
'test sample',
209221
data_input,
210222
data_sample=data_sample,
223+
draw_gt=self.draw_gt,
224+
draw_pred=self.draw_pred,
211225
show=self.show,
212226
vis_task=self.vis_task,
213227
wait_time=self.wait_time,

0 commit comments

Comments
 (0)