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
OpenPCDet
Commits
59496284
Unverified
Commit
59496284
authored
Nov 25, 2020
by
Shaoshuai Shi
Committed by
GitHub
Nov 25, 2020
Browse files
add kitti_utils.py for evaluating with KITTI metrics (#374)
* add kitti_utils.py for evaluating with KITTI metrics
parent
d5655a41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
pcdet/datasets/kitti/kitti_utils.py
pcdet/datasets/kitti/kitti_utils.py
+44
-0
No files found.
pcdet/datasets/kitti/kitti_utils.py
0 → 100644
View file @
59496284
import
numpy
as
np
from
...utils
import
box_utils
def
transform_annotations_to_kitti_format
(
annos
,
map_name_to_kitti
=
None
,
info_with_fakelidar
=
False
):
"""
Args:
annos:
map_name_to_kitti: dict, map name to KITTI names (Car, Pedestrian, Cyclist)
info_with_fakelidar:
Returns:
"""
for
anno
in
annos
:
for
k
in
range
(
anno
[
'name'
].
shape
[
0
]):
anno
[
'name'
][
k
]
=
map_name_to_kitti
[
anno
[
'name'
][
k
]]
anno
[
'bbox'
]
=
np
.
zeros
((
len
(
anno
[
'name'
]),
4
))
anno
[
'bbox'
][:,
2
:
4
]
=
50
# [0, 0, 50, 50]
anno
[
'truncated'
]
=
np
.
zeros
(
len
(
anno
[
'name'
]))
anno
[
'occluded'
]
=
np
.
zeros
(
len
(
anno
[
'name'
]))
if
'boxes_lidar'
in
anno
:
gt_boxes_lidar
=
anno
[
'boxes_lidar'
].
copy
()
else
:
gt_boxes_lidar
=
anno
[
'gt_boxes_lidar'
].
copy
()
if
len
(
gt_boxes_lidar
)
>
0
:
if
info_with_fakelidar
:
gt_boxes_lidar
=
box_utils
.
boxes3d_kitti_fakelidar_to_lidar
(
gt_boxes_lidar
)
gt_boxes_lidar
[:,
2
]
-=
gt_boxes_lidar
[:,
5
]
/
2
anno
[
'location'
]
=
np
.
zeros
((
gt_boxes_lidar
.
shape
[
0
],
3
))
anno
[
'location'
][:,
0
]
=
-
gt_boxes_lidar
[:,
1
]
# x = -y_lidar
anno
[
'location'
][:,
1
]
=
-
gt_boxes_lidar
[:,
2
]
# y = -z_lidar
anno
[
'location'
][:,
2
]
=
gt_boxes_lidar
[:,
0
]
# z = x_lidar
dxdydz
=
gt_boxes_lidar
[:,
3
:
6
]
anno
[
'dimensions'
]
=
dxdydz
[:,
[
0
,
2
,
1
]]
# lwh ==> lhw
anno
[
'rotation_y'
]
=
-
gt_boxes_lidar
[:,
6
]
-
np
.
pi
/
2.0
anno
[
'alpha'
]
=
-
np
.
arctan2
(
-
gt_boxes_lidar
[:,
1
],
gt_boxes_lidar
[:,
0
])
+
anno
[
'rotation_y'
]
else
:
anno
[
'location'
]
=
anno
[
'dimensions'
]
=
np
.
zeros
((
0
,
3
))
anno
[
'rotation_y'
]
=
anno
[
'alpha'
]
=
np
.
zeros
(
0
)
return
annos
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