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
c0658238
Commit
c0658238
authored
Apr 28, 2020
by
liyinhao
Browse files
finish indoor_flip and test unit
parent
3b9ade96
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
0 deletions
+85
-0
mmdet3d/datasets/pipelines/indoor_augment.py
mmdet3d/datasets/pipelines/indoor_augment.py
+42
-0
mmdet3d/datasets/pipelines/indoor_loading.py
mmdet3d/datasets/pipelines/indoor_loading.py
+4
-0
tests/test_indoor_augment.py
tests/test_indoor_augment.py
+39
-0
No files found.
mmdet3d/datasets/pipelines/indoor_augment.py
0 → 100644
View file @
c0658238
import
numpy
as
np
from
mmdet.datasets.registry
import
PIPELINES
@
PIPELINES
.
register_module
()
class
IndoorFlipData
(
object
):
"""Indoor Flip Data
Flip the points and groundtruth boxes.
Args:
name (str): name of the dataset.
"""
def
__init__
(
self
,
name
):
assert
name
in
[
'scannet'
,
'sunrgbd'
]
self
.
name
=
name
def
__call__
(
self
,
results
):
point_cloud
=
results
.
get
(
'point_cloud'
,
None
)
gt_boxes
=
results
.
get
(
'gt_boxes'
,
None
)
if
np
.
random
.
random
()
>
0.5
:
# Flipping along the YZ plane
point_cloud
[:,
0
]
=
-
1
*
point_cloud
[:,
0
]
gt_boxes
[:,
0
]
=
-
1
*
gt_boxes
[:,
0
]
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
point_cloud
[:,
1
]
=
-
1
*
point_cloud
[:,
1
]
gt_boxes
[:,
1
]
=
-
1
*
gt_boxes
[:,
1
]
results
[
'gt_boxes'
]
=
gt_boxes
results
[
'point_cloud'
]
=
point_cloud
return
results
def
__repr__
(
self
):
repr_str
=
self
.
__class__
.
__name__
repr_str
+=
'(dataset_name={})'
.
format
(
self
.
name
)
return
repr_str
mmdet3d/datasets/pipelines/indoor_loading.py
View file @
c0658238
...
@@ -70,6 +70,10 @@ class IndoorLoadData(object):
...
@@ -70,6 +70,10 @@ class IndoorLoadData(object):
def
__repr__
(
self
):
def
__repr__
(
self
):
repr_str
=
self
.
__class__
.
__name__
repr_str
=
self
.
__class__
.
__name__
repr_str
+=
'(dataset_name={})'
.
format
(
self
.
name
)
repr_str
+=
'(use_height={})'
.
format
(
self
.
use_height
)
repr_str
+=
'(use_color={}'
.
format
(
self
.
use_color
)
repr_str
+=
'(mean_color={})'
.
format
(
self
.
mean_color
)
return
repr_str
return
repr_str
def
_get_lidar
(
self
,
scan_name
,
data_path
):
def
_get_lidar
(
self
,
scan_name
,
data_path
):
...
...
tests/test_indoor_augment.py
0 → 100644
View file @
c0658238
import
numpy
as
np
from
mmdet3d.datasets.pipelines.indoor_augment
import
IndoorFlipData
def
test_indoor_flip_data
():
sunrgbd_flip_data
=
IndoorFlipData
(
'sunrgbd'
)
sunrgbd_results
=
dict
()
sunrgbd_results
[
'point_cloud'
]
=
np
.
array
(
[[
1.02828765e+00
,
3.65790772e+00
,
1.97294697e-01
,
1.61959505e+00
],
[
-
3.95979017e-01
,
1.05465031e+00
,
-
7.49204338e-01
,
6.73096001e-01
]])
sunrgbd_results
[
'gt_boxes'
]
=
np
.
array
([[
0.213684
,
1.036364
,
-
0.982323
,
0.61541
,
0.572574
,
0.872728
,
3.07028526
],
[
-
0.449953
,
1.395455
,
-
1.027778
,
1.500956
,
1.637298
,
0.636364
,
-
1.58242359
]])
sunrgbd_results
=
sunrgbd_flip_data
(
sunrgbd_results
)
sunrgbd_point_cloud
=
sunrgbd_results
.
get
(
'point_cloud'
,
None
)
sunrgbd_gt_boxes
=
sunrgbd_results
.
get
(
'gt_boxes'
,
None
)
assert
sunrgbd_point_cloud
.
shape
==
(
2
,
4
)
assert
sunrgbd_gt_boxes
.
shape
==
(
2
,
7
)
scannet_flip_data
=
IndoorFlipData
(
'scannet'
)
scannet_results
=
dict
()
scannet_results
[
'point_cloud'
]
=
np
.
array
(
[[
1.6110241e+00
,
-
1.6903955e-01
,
5.8115810e-01
,
5.9897250e-01
],
[
1.3978075e+00
,
4.2035791e-01
,
3.8729519e-01
,
4.0510958e-01
]])
scannet_results
[
'gt_boxes'
]
=
np
.
array
([[
0.55903838
,
0.48201692
,
0.65688646
,
0.65370704
,
0.60029864
,
0.5163464
],
[
-
0.03226406
,
1.70392646
,
0.60348618
,
0.65165804
,
0.72084366
,
0.64667457
]])
scannet_results
=
scannet_flip_data
(
scannet_results
)
scannet_point_cloud
=
scannet_results
.
get
(
'point_cloud'
,
None
)
scannet_gt_boxes
=
scannet_results
.
get
(
'gt_boxes'
,
None
)
assert
scannet_point_cloud
.
shape
==
(
2
,
4
)
assert
scannet_gt_boxes
.
shape
==
(
2
,
6
)
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