Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
mmdetection3d
Commits
97f388fd
Commit
97f388fd
authored
Jun 21, 2020
by
liyinhao
Browse files
Can create kitti_gt
parent
d59a0287
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
tools/data_converter/create_gt_database.py
tools/data_converter/create_gt_database.py
+22
-8
No files found.
tools/data_converter/create_gt_database.py
View file @
97f388fd
...
...
@@ -147,6 +147,7 @@ def create_groundtruth_database(dataset_class_name,
data_root
=
data_path
,
ann_file
=
info_path
,
)
file_client_args
=
dict
(
backend
=
'disk'
)
if
dataset_class_name
==
'KittiDataset'
:
dataset_cfg
.
update
(
test_mode
=
False
,
...
...
@@ -156,7 +157,19 @@ def create_groundtruth_database(dataset_class_name,
use_depth
=
False
,
use_lidar_intensity
=
True
,
use_camera
=
with_mask
,
))
),
pipeline
=
[
dict
(
type
=
'LoadPointsFromFile'
,
load_dim
=
4
,
use_dim
=
4
,
file_client_args
=
file_client_args
),
dict
(
type
=
'LoadAnnotations3D'
,
with_bbox_3d
=
True
,
with_label_3d
=
True
,
file_client_args
=
file_client_args
)
])
dataset
=
build_dataset
(
dataset_cfg
)
if
database_save_path
is
None
:
...
...
@@ -178,14 +191,15 @@ def create_groundtruth_database(dataset_class_name,
group_counter
=
0
for
j
in
track_iter_progress
(
list
(
range
(
len
(
dataset
)))):
annos
=
dataset
.
get_data_info
(
j
)
image_idx
=
annos
[
'sample_idx'
]
points
=
np
.
fromfile
(
annos
[
'pts_file_name'
],
dtype
=
np
.
float32
).
reshape
(
-
1
,
4
)
gt_boxes_3d
=
annos
[
'ann_info'
][
'gt_bboxes_3d'
]
input_dict
=
dataset
.
get_data_info
(
j
)
dataset
.
pre_pipeline
(
input_dict
)
example
=
dataset
.
pipeline
(
input_dict
)
annos
=
example
[
'ann_info'
]
image_idx
=
example
[
'sample_idx'
]
points
=
example
[
'points'
]
gt_boxes_3d
=
annos
[
'gt_bboxes_3d'
].
tensor
.
numpy
()
names
=
annos
[
'gt_names'
]
group_dict
=
dict
()
group_ids
=
np
.
full
([
gt_boxes_3d
.
shape
[
0
]],
-
1
,
dtype
=
np
.
int64
)
if
'group_ids'
in
annos
:
group_ids
=
annos
[
'group_ids'
]
else
:
...
...
@@ -200,7 +214,7 @@ def create_groundtruth_database(dataset_class_name,
if
with_mask
:
# prepare masks
gt_boxes
=
annos
[
'gt_bboxes'
]
img_path
=
annos
[
'filename'
]
.
split
(
'/'
)[
-
1
]
img_path
=
osp
.
split
(
example
[
'img_info'
]
[
'filename'
])[
-
1
]
if
img_path
not
in
file2id
.
keys
():
print
(
'skip image {} for empty mask'
.
format
(
img_path
))
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment