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

feat(local_visualizer.py): add check dir exist #1828

Merged
merged 4 commits into from
Sep 16, 2022
Merged
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion mmdet3d/visualization/local_visualizer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
from os import path as osp
from typing import Dict, List, Optional, Tuple, Union

Expand Down Expand Up @@ -517,7 +518,6 @@ def add_datasample(self,
pred_seg_data_3d = None
gt_img_data = None
pred_img_data = None

if draw_gt and data_sample is not None:
if 'gt_instances_3d' in data_sample:
gt_data_3d = self._draw_instances_3d(
Expand Down Expand Up @@ -605,6 +605,9 @@ def add_datasample(self,
win_name=name,
wait_time=wait_time)

if not osp.exists(out_file):
tpoisonooo marked this conversation as resolved.
Show resolved Hide resolved
os.mkdir(out_file)

if out_file is not None:
if drawn_img_3d is not None:
mmcv.imwrite(drawn_img_3d[..., ::-1], out_file + '.jpg')
Expand Down