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
e9ef0711
Commit
e9ef0711
authored
Apr 29, 2020
by
liyinhao
Browse files
add indoor_load_data test unit
parent
d9c7fb38
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
19 deletions
+41
-19
mmdet3d/datasets/pipelines/indoor_augment.py
mmdet3d/datasets/pipelines/indoor_augment.py
+2
-2
mmdet3d/datasets/pipelines/indoor_loading.py
mmdet3d/datasets/pipelines/indoor_loading.py
+15
-13
tests/test_indoor_augment.py
tests/test_indoor_augment.py
+4
-4
tests/test_indoor_loading.py
tests/test_indoor_loading.py
+20
-0
No files found.
mmdet3d/datasets/pipelines/indoor_augment.py
View file @
e9ef0711
...
@@ -123,8 +123,8 @@ class IndoorRotateData(object):
...
@@ -123,8 +123,8 @@ class IndoorRotateData(object):
@
PIPELINES
.
register_module
()
@
PIPELINES
.
register_module
()
class
Indoor
Shuffle
Data
(
object
):
class
Point
Shuffle
(
object
):
"""
Indoor
Shuffle
Data
"""
Point
Shuffle
.
Shuffle points.
Shuffle points.
"""
"""
...
...
mmdet3d/datasets/pipelines/indoor_loading.py
View file @
e9ef0711
...
@@ -39,28 +39,30 @@ class IndoorLoadData(object):
...
@@ -39,28 +39,30 @@ class IndoorLoadData(object):
gt_boxes_mask
=
np
.
zeros
((
1
,
1
))
gt_boxes_mask
=
np
.
zeros
((
1
,
1
))
if
self
.
name
==
'scannet'
:
if
self
.
name
==
'scannet'
:
scan_name
=
info
[
'point
s
'
][
'lidar_idx'
]
scan_name
=
info
[
'point
_cloud
'
][
'lidar_idx'
]
point
s
=
self
.
_get_lidar
(
scan_name
,
data_path
)
point
_cloud
=
self
.
_get_lidar
(
scan_name
,
data_path
)
instance_labels
=
self
.
_get_instance_label
(
scan_name
,
data_path
)
instance_labels
=
self
.
_get_instance_label
(
scan_name
,
data_path
)
semantic_labels
=
self
.
_get_semantic_label
(
scan_name
,
data_path
)
semantic_labels
=
self
.
_get_semantic_label
(
scan_name
,
data_path
)
else
:
else
:
point
s
=
np
.
load
(
point
_cloud
=
np
.
load
(
osp
.
join
(
data_path
,
'lidar'
,
osp
.
join
(
data_path
,
'lidar'
,
'%06d.npz'
%
info
[
'point
s
'
][
'lidar_idx'
]))[
'pc'
]
'%06d.npz'
%
info
[
'point
_cloud
'
][
'lidar_idx'
]))[
'pc'
]
if
not
self
.
use_color
:
if
not
self
.
use_color
:
point
s
=
point
s
[:,
0
:
3
]
# do not use color for now
point
_cloud
=
point
_cloud
[:,
0
:
3
]
# do not use color for now
pcl_color
=
point
s
[:,
3
:
6
]
pcl_color
=
point
_cloud
[:,
3
:
6
]
else
:
else
:
points
=
points
[:,
0
:
6
]
point_cloud
=
point_cloud
[:,
0
:
6
]
pcl_color
=
points
[:,
3
:
6
]
pcl_color
=
point_cloud
[:,
3
:
6
]
points
[:,
3
:]
=
(
points
[:,
3
:]
-
np
.
array
(
self
.
mean_color
))
/
256.0
point_cloud
[:,
3
:]
=
(
point_cloud
[:,
3
:]
-
np
.
array
(
self
.
mean_color
))
/
256.0
if
self
.
use_height
:
if
self
.
use_height
:
floor_height
=
np
.
percentile
(
points
[:,
2
],
0.99
)
floor_height
=
np
.
percentile
(
point_cloud
[:,
2
],
0.99
)
height
=
points
[:,
2
]
-
floor_height
height
=
point_cloud
[:,
2
]
-
floor_height
points
=
np
.
concatenate
([
points
,
np
.
expand_dims
(
height
,
1
)],
1
)
point_cloud
=
np
.
concatenate
(
results
[
'points'
]
=
points
[
point_cloud
,
np
.
expand_dims
(
height
,
1
)],
1
)
results
[
'point_cloud'
]
=
point_cloud
if
self
.
name
==
'scannet'
:
if
self
.
name
==
'scannet'
:
results
[
'pcl_color'
]
=
pcl_color
results
[
'pcl_color'
]
=
pcl_color
...
...
tests/test_indoor_augment.py
View file @
e9ef0711
...
@@ -2,7 +2,7 @@ import numpy as np
...
@@ -2,7 +2,7 @@ import numpy as np
from
mmdet3d.datasets.pipelines.indoor_augment
import
(
IndoorFlipData
,
from
mmdet3d.datasets.pipelines.indoor_augment
import
(
IndoorFlipData
,
IndoorRotateData
,
IndoorRotateData
,
Indoor
Shuffle
Data
)
Point
Shuffle
)
def
test_indoor_flip_data
():
def
test_indoor_flip_data
():
...
@@ -80,12 +80,12 @@ def test_indoor_rotate_data():
...
@@ -80,12 +80,12 @@ def test_indoor_rotate_data():
assert
scannet_gt_boxes
.
shape
==
(
2
,
6
)
assert
scannet_gt_boxes
.
shape
==
(
2
,
6
)
def
test_
indoor
_shuffle
_data
():
def
test_
point
_shuffle
():
indoor
_shuffle
_data
=
Indoor
Shuffle
Data
()
point
_shuffle
=
Point
Shuffle
()
results
=
dict
()
results
=
dict
()
results
[
'points'
]
=
np
.
array
(
results
[
'points'
]
=
np
.
array
(
[[
1.02828765e+00
,
3.65790772e+00
,
1.97294697e-01
,
1.61959505e+00
],
[[
1.02828765e+00
,
3.65790772e+00
,
1.97294697e-01
,
1.61959505e+00
],
[
-
3.95979017e-01
,
1.05465031e+00
,
-
7.49204338e-01
,
6.73096001e-01
]])
[
-
3.95979017e-01
,
1.05465031e+00
,
-
7.49204338e-01
,
6.73096001e-01
]])
results
=
indoor
_shuffle
_data
(
results
)
results
=
point
_shuffle
(
results
)
points
=
results
.
get
(
'points'
)
points
=
results
.
get
(
'points'
)
assert
points
.
shape
==
(
2
,
4
)
assert
points
.
shape
==
(
2
,
4
)
tests/test_indoor_loading.py
0 → 100644
View file @
e9ef0711
import
mmcv
from
mmdet3d.datasets.pipelines.indoor_loading
import
IndoorLoadData
def
test_indoor_load_data
():
train_info
=
mmcv
.
load
(
'./tests/data/sunrgbd/sunrgbd_infos_train.pkl'
)
sunrgbd_load_data
=
IndoorLoadData
(
'sunrgbd'
,
False
,
True
,
[
0.5
,
0.5
,
0.5
])
sunrgbd_results
=
dict
()
sunrgbd_results
[
'data_path'
]
=
'./tests/data/sunrgbd/sunrgbd_trainval'
sunrgbd_results
[
'info'
]
=
train_info
[
0
]
sunrgbd_results
=
sunrgbd_load_data
(
sunrgbd_results
)
point_cloud
=
sunrgbd_results
.
get
(
'point_cloud'
,
None
)
gt_boxes
=
sunrgbd_results
.
get
(
'gt_boxes'
,
None
)
gt_classes
=
sunrgbd_results
.
get
(
'gt_classes'
,
None
)
gt_boxes_mask
=
sunrgbd_results
.
get
(
'gt_boxes_mask'
,
None
)
assert
point_cloud
.
shape
==
(
50000
,
4
)
assert
gt_boxes
.
shape
==
(
3
,
7
)
assert
gt_classes
.
shape
==
(
3
,
1
)
assert
gt_boxes_mask
.
shape
==
(
3
,
1
)
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