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

[Enhance] Lidar visualization #2611

Merged
merged 9 commits into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/_base_/datasets/semantickitti.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
dataset_type='semantickitti',
backend_args=backend_args),
dict(type='PointSegClassMapping'),
dict(type='Pack3DDetInputs', keys=['points'])
dict(type='Pack3DDetInputs', keys=['points', 'pts_semantic_mask'])
]
# construct a pipeline for data and gt loading in show function
# please keep its loading function consistent with test_pipeline (e.g. client)
Expand Down
2 changes: 1 addition & 1 deletion demo/mono_det_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def main(args):
data_sample=result,
draw_gt=False,
show=args.show,
wait_time=0,
wait_time=-1,
out_file=args.out_dir,
pred_score_thr=args.score_thr,
vis_task='mono_det')
Expand Down
2 changes: 1 addition & 1 deletion demo/multi_modality_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def main(args):
data_sample=result,
draw_gt=False,
show=args.show,
wait_time=0,
wait_time=-1,
out_file=args.out_dir,
pred_score_thr=args.score_thr,
vis_task='multi-modality_det')
Expand Down
2 changes: 1 addition & 1 deletion demo/pcd_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def main(args):
data_sample=result,
draw_gt=False,
show=args.show,
wait_time=0,
wait_time=-1,
out_file=args.out_dir,
pred_score_thr=args.score_thr,
vis_task='lidar_det')
Expand Down
2 changes: 1 addition & 1 deletion demo/pcd_seg_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main(args):
data_sample=result,
draw_gt=False,
show=args.show,
wait_time=0,
wait_time=-1,
out_file=args.out_dir,
vis_task='lidar_seg')

Expand Down
14 changes: 14 additions & 0 deletions mmdet3d/engine/hooks/visualization_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numpy as np
from mmengine.fileio import get
from mmengine.hooks import Hook
from mmengine.logging import print_log
from mmengine.runner import Runner
from mmengine.utils import mkdir_or_exist
from mmengine.visualization import Visualizer
Expand Down Expand Up @@ -56,6 +57,8 @@ def __init__(self,
vis_task: str = 'mono_det',
wait_time: float = 0.,
test_out_dir: Optional[str] = None,
draw_gt: bool = True,
draw_pred: bool = True,
backend_args: Optional[dict] = None):
self._visualizer: Visualizer = Visualizer.get_current_instance()
self.interval = interval
Expand All @@ -70,11 +73,20 @@ def __init__(self,
'needs to be excluded.')
self.vis_task = vis_task

if wait_time == -1:
print_log(
'Manual control mode, press [Right] to next sample.',
logger='current')
else:
print_log(
'Autoplay mode, press [SPACE] to pause.', logger='current')
self.wait_time = wait_time
self.backend_args = backend_args
self.draw = draw
self.test_out_dir = test_out_dir
self._test_index = 0
self.draw_gt = draw_gt
self.draw_pred = draw_pred

def after_val_iter(self, runner: Runner, batch_idx: int, data_batch: dict,
outputs: Sequence[Det3DDataSample]) -> None:
Expand Down Expand Up @@ -208,6 +220,8 @@ def after_test_iter(self, runner: Runner, batch_idx: int, data_batch: dict,
'test sample',
data_input,
data_sample=data_sample,
draw_gt=self.draw_gt,
draw_pred=self.draw_pred,
show=self.show,
vis_task=self.vis_task,
wait_time=self.wait_time,
Expand Down
Loading