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
5d602360
Commit
5d602360
authored
May 09, 2020
by
liyinhao
Browse files
change flip
parent
fcb05070
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
14 deletions
+18
-14
mmdet3d/datasets/__init__.py
mmdet3d/datasets/__init__.py
+6
-4
mmdet3d/datasets/pipelines/__init__.py
mmdet3d/datasets/pipelines/__init__.py
+3
-0
mmdet3d/datasets/pipelines/indoor_augment.py
mmdet3d/datasets/pipelines/indoor_augment.py
+6
-6
tests/test_indoor_augment.py
tests/test_indoor_augment.py
+3
-4
No files found.
mmdet3d/datasets/__init__.py
View file @
5d602360
...
@@ -5,14 +5,16 @@ from .kitti2d_dataset import Kitti2DDataset
...
@@ -5,14 +5,16 @@ from .kitti2d_dataset import Kitti2DDataset
from
.kitti_dataset
import
KittiDataset
from
.kitti_dataset
import
KittiDataset
from
.loader
import
DistributedGroupSampler
,
GroupSampler
,
build_dataloader
from
.loader
import
DistributedGroupSampler
,
GroupSampler
,
build_dataloader
from
.nuscenes_dataset
import
NuScenesDataset
from
.nuscenes_dataset
import
NuScenesDataset
from
.pipelines
import
(
GlobalRotScale
,
ObjectNoise
,
ObjectRangeFilter
,
from
.pipelines
import
(
GlobalRotScale
,
IndoorFlipData
,
IndoorGlobalRotScale
,
ObjectSample
,
PointShuffle
,
PointsRangeFilter
,
IndoorPointsColorJitter
,
ObjectNoise
,
RandomFlip3D
)
ObjectRangeFilter
,
ObjectSample
,
PointShuffle
,
PointsRangeFilter
,
RandomFlip3D
)
__all__
=
[
__all__
=
[
'KittiDataset'
,
'GroupSampler'
,
'DistributedGroupSampler'
,
'KittiDataset'
,
'GroupSampler'
,
'DistributedGroupSampler'
,
'build_dataloader'
,
'RepeatFactorDataset'
,
'DATASETS'
,
'build_dataset'
,
'build_dataloader'
,
'RepeatFactorDataset'
,
'DATASETS'
,
'build_dataset'
,
'CocoDataset'
,
'Kitti2DDataset'
,
'NuScenesDataset'
,
'ObjectSample'
,
'CocoDataset'
,
'Kitti2DDataset'
,
'NuScenesDataset'
,
'ObjectSample'
,
'RandomFlip3D'
,
'ObjectNoise'
,
'GlobalRotScale'
,
'PointShuffle'
,
'RandomFlip3D'
,
'ObjectNoise'
,
'GlobalRotScale'
,
'PointShuffle'
,
'ObjectRangeFilter'
,
'PointsRangeFilter'
,
'Collect3D'
'ObjectRangeFilter'
,
'PointsRangeFilter'
,
'Collect3D'
,
'IndoorPointsColorJitter'
,
'IndoorGlobalRotScale'
,
'IndoorFlipData'
]
]
mmdet3d/datasets/pipelines/__init__.py
View file @
5d602360
from
mmdet.datasets.pipelines
import
Compose
from
mmdet.datasets.pipelines
import
Compose
from
.dbsampler
import
DataBaseSampler
,
MMDataBaseSampler
from
.dbsampler
import
DataBaseSampler
,
MMDataBaseSampler
from
.formating
import
DefaultFormatBundle
,
DefaultFormatBundle3D
from
.formating
import
DefaultFormatBundle
,
DefaultFormatBundle3D
from
.indoor_augment
import
(
IndoorFlipData
,
IndoorGlobalRotScale
,
IndoorPointsColorJitter
)
from
.loading
import
LoadMultiViewImageFromFiles
,
LoadPointsFromFile
from
.loading
import
LoadMultiViewImageFromFiles
,
LoadPointsFromFile
from
.train_aug
import
(
GlobalRotScale
,
ObjectNoise
,
ObjectRangeFilter
,
from
.train_aug
import
(
GlobalRotScale
,
ObjectNoise
,
ObjectRangeFilter
,
ObjectSample
,
PointShuffle
,
PointsRangeFilter
,
ObjectSample
,
PointShuffle
,
PointsRangeFilter
,
...
@@ -11,5 +13,6 @@ __all__ = [
...
@@ -11,5 +13,6 @@ __all__ = [
'PointShuffle'
,
'ObjectRangeFilter'
,
'PointsRangeFilter'
,
'Collect3D'
,
'PointShuffle'
,
'ObjectRangeFilter'
,
'PointsRangeFilter'
,
'Collect3D'
,
'Compose'
,
'LoadMultiViewImageFromFiles'
,
'LoadPointsFromFile'
,
'Compose'
,
'LoadMultiViewImageFromFiles'
,
'LoadPointsFromFile'
,
'DefaultFormatBundle'
,
'DefaultFormatBundle3D'
,
'DataBaseSampler'
,
'DefaultFormatBundle'
,
'DefaultFormatBundle3D'
,
'DataBaseSampler'
,
'IndoorGlobalRotScale'
,
'IndoorPointsColorJitter'
,
'IndoorFlipData'
,
'MMDataBaseSampler'
'MMDataBaseSampler'
]
]
mmdet3d/datasets/pipelines/indoor_augment.py
View file @
5d602360
...
@@ -26,21 +26,21 @@ class IndoorFlipData(object):
...
@@ -26,21 +26,21 @@ class IndoorFlipData(object):
points
=
results
[
'points'
]
points
=
results
[
'points'
]
gt_bboxes_3d
=
results
[
'gt_bboxes_3d'
]
gt_bboxes_3d
=
results
[
'gt_bboxes_3d'
]
aligned
=
True
if
gt_bboxes_3d
.
shape
[
1
]
==
6
else
False
aligned
=
True
if
gt_bboxes_3d
.
shape
[
1
]
==
6
else
False
if
np
.
random
.
random
()
>
self
.
flip_ratio_yz
:
if
np
.
random
.
random
()
<
self
.
flip_ratio_yz
:
# Flipping along the YZ plane
# Flipping along the YZ plane
points
[:,
0
]
=
-
1
*
points
[:,
0
]
points
[:,
0
]
=
-
1
*
points
[:,
0
]
gt_bboxes_3d
[:,
0
]
=
-
1
*
gt_bboxes_3d
[:,
0
]
gt_bboxes_3d
[:,
0
]
=
-
1
*
gt_bboxes_3d
[:,
0
]
if
not
aligned
:
if
not
aligned
:
gt_bboxes_3d
[:,
6
]
=
np
.
pi
-
gt_bboxes_3d
[:,
6
]
gt_bboxes_3d
[:,
6
]
=
np
.
pi
-
gt_bboxes_3d
[:,
6
]
results
[
'flip'
]
=
True
results
[
'flip
_yz
'
]
=
True
results
[
'gt_boxes'
]
=
gt_bboxes_3d
results
[
'gt_boxes'
]
=
gt_bboxes_3d
if
aligned
and
np
.
random
.
random
()
>
self
.
flip_ratio_xz
:
if
aligned
and
np
.
random
.
random
()
<
self
.
flip_ratio_xz
:
# Flipping along the XZ plane
# Flipping along the XZ plane
points
[:,
1
]
=
-
1
*
points
[:,
1
]
points
[:,
1
]
=
-
1
*
points
[:,
1
]
gt_bboxes_3d
[:,
1
]
=
-
1
*
gt_bboxes_3d
[:,
1
]
gt_bboxes_3d
[:,
1
]
=
-
1
*
gt_bboxes_3d
[:,
1
]
results
[
'flip'
]
=
True
results
[
'flip
_xz
'
]
=
True
results
[
'gt_bboxes_3d'
]
=
gt_bboxes_3d
results
[
'gt_bboxes_3d'
]
=
gt_bboxes_3d
results
[
'points'
]
=
points
results
[
'points'
]
=
points
...
@@ -189,14 +189,14 @@ class IndoorGlobalRotScale(object):
...
@@ -189,14 +189,14 @@ class IndoorGlobalRotScale(object):
def
__call__
(
self
,
results
):
def
__call__
(
self
,
results
):
points
=
results
[
'points'
]
points
=
results
[
'points'
]
gt_bboxes_3d
=
results
[
'gt_bboxes_3d'
]
gt_bboxes_3d
=
results
[
'gt_bboxes_3d'
]
name
=
'scannet'
if
gt_bboxes_3d
.
shape
[
1
]
==
6
else
'sunrgbd'
aligned
=
True
if
gt_bboxes_3d
.
shape
[
1
]
==
6
else
False
if
self
.
rot_range
is
not
None
:
if
self
.
rot_range
is
not
None
:
assert
len
(
self
.
rot_range
)
==
2
assert
len
(
self
.
rot_range
)
==
2
rot_angle
=
np
.
random
.
uniform
(
self
.
rot_range
[
0
],
self
.
rot_range
[
1
])
rot_angle
=
np
.
random
.
uniform
(
self
.
rot_range
[
0
],
self
.
rot_range
[
1
])
rot_mat
=
self
.
_rotz
(
rot_angle
)
rot_mat
=
self
.
_rotz
(
rot_angle
)
points
[:,
:
3
]
=
np
.
dot
(
points
[:,
:
3
],
rot_mat
.
T
)
points
[:,
:
3
]
=
np
.
dot
(
points
[:,
:
3
],
rot_mat
.
T
)
if
name
==
'scannet'
:
if
aligned
:
gt_bboxes_3d
=
self
.
_rotate_aligned_boxes
(
gt_bboxes_3d
=
self
.
_rotate_aligned_boxes
(
gt_bboxes_3d
,
rot_mat
)
gt_bboxes_3d
,
rot_mat
)
else
:
else
:
...
...
tests/test_indoor_augment.py
View file @
5d602360
import
numpy
as
np
import
numpy
as
np
from
mmdet3d.datasets.pipelines.indoor_augment
import
(
IndoorFlipData
,
from
mmdet3d.datasets.pipelines
import
IndoorFlipData
,
IndoorGlobalRotScale
IndoorGlobalRotScale
)
def
test_indoor_flip_data
():
def
test_indoor_flip_data
():
np
.
random
.
seed
(
0
)
np
.
random
.
seed
(
0
)
sunrgbd_indoor_flip_data
=
IndoorFlipData
()
sunrgbd_indoor_flip_data
=
IndoorFlipData
(
1
,
1
)
sunrgbd_results
=
dict
()
sunrgbd_results
=
dict
()
sunrgbd_results
[
'points'
]
=
np
.
array
(
sunrgbd_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
],
...
@@ -36,7 +35,7 @@ def test_indoor_flip_data():
...
@@ -36,7 +35,7 @@ def test_indoor_flip_data():
assert
np
.
allclose
(
sunrgbd_gt_bboxes_3d
,
expected_sunrgbd_gt_bboxes_3d
)
assert
np
.
allclose
(
sunrgbd_gt_bboxes_3d
,
expected_sunrgbd_gt_bboxes_3d
)
np
.
random
.
seed
(
0
)
np
.
random
.
seed
(
0
)
scannet_indoor_flip_data
=
IndoorFlipData
()
scannet_indoor_flip_data
=
IndoorFlipData
(
1
,
1
)
scannet_results
=
dict
()
scannet_results
=
dict
()
scannet_results
[
'points'
]
=
np
.
array
(
scannet_results
[
'points'
]
=
np
.
array
(
[[
1.6110241e+00
,
-
1.6903955e-01
,
5.8115810e-01
,
5.9897250e-01
],
[[
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