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
d9c7fb38
Commit
d9c7fb38
authored
Apr 28, 2020
by
liyinhao
Browse files
add empty lines
parent
6ce6b0fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
mmdet3d/datasets/pipelines/indoor_augment.py
mmdet3d/datasets/pipelines/indoor_augment.py
+4
-0
mmdet3d/datasets/pipelines/indoor_loading.py
mmdet3d/datasets/pipelines/indoor_loading.py
+5
-0
tests/test_indoor_augment.py
tests/test_indoor_augment.py
+4
-1
No files found.
mmdet3d/datasets/pipelines/indoor_augment.py
View file @
d9c7fb38
...
...
@@ -60,6 +60,7 @@ class IndoorFlipData(object):
def
__call__
(
self
,
results
):
points
=
results
.
get
(
'points'
,
None
)
gt_boxes
=
results
.
get
(
'gt_boxes'
,
None
)
if
np
.
random
.
random
()
>
0.5
:
# Flipping along the YZ plane
points
[:,
0
]
=
-
1
*
points
[:,
0
]
...
...
@@ -67,6 +68,7 @@ class IndoorFlipData(object):
if
self
.
name
==
'sunrgbd'
:
gt_boxes
[:,
6
]
=
np
.
pi
-
gt_boxes
[:,
6
]
results
[
'gt_boxes'
]
=
gt_boxes
if
self
.
name
==
'scannet'
and
np
.
random
.
random
()
>
0.5
:
# Flipping along the XZ plane
points
[:,
1
]
=
-
1
*
points
[:,
1
]
...
...
@@ -103,11 +105,13 @@ class IndoorRotateData(object):
3
)
-
np
.
pi
/
6
# -30 ~ +30 degree
rot_mat
=
_rotz
(
rot_angle
)
points
[:,
0
:
3
]
=
np
.
dot
(
points
[:,
0
:
3
],
np
.
transpose
(
rot_mat
))
if
self
.
name
==
'scannet'
:
gt_boxes
=
_rotate_aligned_boxes
(
gt_boxes
,
rot_mat
)
else
:
gt_boxes
[:,
0
:
3
]
=
np
.
dot
(
gt_boxes
[:,
0
:
3
],
np
.
transpose
(
rot_mat
))
gt_boxes
[:,
6
]
-=
rot_angle
results
[
'points'
]
=
points
results
[
'gt_boxes'
]
=
gt_boxes
return
results
...
...
mmdet3d/datasets/pipelines/indoor_loading.py
View file @
d9c7fb38
...
...
@@ -28,6 +28,7 @@ class IndoorLoadData(object):
def
__call__
(
self
,
results
):
data_path
=
results
.
get
(
'data_path'
,
None
)
info
=
results
.
get
(
'info'
,
None
)
if
info
[
'annos'
][
'gt_num'
]
!=
0
:
gt_boxes
=
info
[
'annos'
][
'gt_boxes_upright_depth'
]
gt_classes
=
info
[
'annos'
][
'class'
].
reshape
(
-
1
,
1
)
...
...
@@ -36,6 +37,7 @@ class IndoorLoadData(object):
gt_boxes
=
np
.
zeros
((
1
,
6
),
dtype
=
np
.
float32
)
gt_classes
=
np
.
zeros
((
1
,
1
))
gt_boxes_mask
=
np
.
zeros
((
1
,
1
))
if
self
.
name
==
'scannet'
:
scan_name
=
info
[
'points'
][
'lidar_idx'
]
points
=
self
.
_get_lidar
(
scan_name
,
data_path
)
...
...
@@ -45,6 +47,7 @@ class IndoorLoadData(object):
points
=
np
.
load
(
osp
.
join
(
data_path
,
'lidar'
,
'%06d.npz'
%
info
[
'points'
][
'lidar_idx'
]))[
'pc'
]
if
not
self
.
use_color
:
points
=
points
[:,
0
:
3
]
# do not use color for now
pcl_color
=
points
[:,
3
:
6
]
...
...
@@ -52,11 +55,13 @@ class IndoorLoadData(object):
points
=
points
[:,
0
:
6
]
pcl_color
=
points
[:,
3
:
6
]
points
[:,
3
:]
=
(
points
[:,
3
:]
-
np
.
array
(
self
.
mean_color
))
/
256.0
if
self
.
use_height
:
floor_height
=
np
.
percentile
(
points
[:,
2
],
0.99
)
height
=
points
[:,
2
]
-
floor_height
points
=
np
.
concatenate
([
points
,
np
.
expand_dims
(
height
,
1
)],
1
)
results
[
'points'
]
=
points
if
self
.
name
==
'scannet'
:
results
[
'pcl_color'
]
=
pcl_color
results
[
'instance_labels'
]
=
instance_labels
...
...
tests/test_indoor_augment.py
View file @
d9c7fb38
...
...
@@ -24,6 +24,7 @@ def test_indoor_flip_data():
sunrgbd_gt_boxes
=
sunrgbd_results
.
get
(
'gt_boxes'
,
None
)
assert
sunrgbd_points
.
shape
==
(
2
,
4
)
assert
sunrgbd_gt_boxes
.
shape
==
(
2
,
7
)
scannet_flip_data
=
IndoorFlipData
(
'scannet'
)
scannet_results
=
dict
()
scannet_results
[
'points'
]
=
np
.
array
(
...
...
@@ -43,7 +44,7 @@ def test_indoor_flip_data():
def
test_indoor_rotate_data
():
sunrgbd_indoor_rotate_data
=
IndoorRotateData
(
'sunrgbd'
)
scannet_indoor_rotate_data
=
IndoorRotateData
(
'scannet'
)
sunrgbd_results
=
dict
()
sunrgbd_results
[
'points'
]
=
np
.
array
(
[[
1.02828765e+00
,
3.65790772e+00
,
1.97294697e-01
,
1.61959505e+00
],
...
...
@@ -61,6 +62,8 @@ def test_indoor_rotate_data():
sunrgbd_gt_boxes
=
sunrgbd_results
.
get
(
'gt_boxes'
,
None
)
assert
sunrgbd_points
.
shape
==
(
2
,
4
)
assert
sunrgbd_gt_boxes
.
shape
==
(
2
,
7
)
scannet_indoor_rotate_data
=
IndoorRotateData
(
'scannet'
)
scannet_results
=
dict
()
scannet_results
[
'points'
]
=
np
.
array
(
[[
1.6110241e+00
,
-
1.6903955e-01
,
5.8115810e-01
,
5.9897250e-01
],
...
...
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