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
c087723d
Commit
c087723d
authored
May 07, 2020
by
liyinhao
Browse files
change name, trans and repr_str
parent
f55c303c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
27 deletions
+25
-27
mmdet3d/core/bbox/box_np_ops.py
mmdet3d/core/bbox/box_np_ops.py
+1
-1
mmdet3d/datasets/pipelines/indoor_augment.py
mmdet3d/datasets/pipelines/indoor_augment.py
+24
-26
No files found.
mmdet3d/core/bbox/box_np_ops.py
View file @
c087723d
...
@@ -242,7 +242,7 @@ def rotation_points_single_angle(points, angle, axis=0):
...
@@ -242,7 +242,7 @@ def rotation_points_single_angle(points, angle, axis=0):
else
:
else
:
raise
ValueError
(
'axis should in range'
)
raise
ValueError
(
'axis should in range'
)
return
points
@
rot_mat_T
,
rot_mat_T
return
points
@
rot_mat_T
.
T
,
rot_mat_T
def
project_to_image
(
points_3d
,
proj_mat
):
def
project_to_image
(
points_3d
,
proj_mat
):
...
...
mmdet3d/datasets/pipelines/indoor_augment.py
View file @
c087723d
...
@@ -3,23 +3,6 @@ import numpy as np
...
@@ -3,23 +3,6 @@ import numpy as np
from
mmdet.datasets.registry
import
PIPELINES
from
mmdet.datasets.registry
import
PIPELINES
def
_rotz
(
t
):
"""Rotate About Z.
Rotation about the z-axis.
Args:
t (float): Angle of rotation.
Returns:
rot_mat (ndarray): Matrix of rotation.
"""
c
=
np
.
cos
(
t
)
s
=
np
.
sin
(
t
)
rot_mat
=
np
.
array
([[
c
,
-
s
,
0
],
[
s
,
c
,
0
],
[
0
,
0
,
1
]])
return
rot_mat
@
PIPELINES
.
register_module
()
@
PIPELINES
.
register_module
()
class
IndoorFlipData
(
object
):
class
IndoorFlipData
(
object
):
"""Indoor Flip Data.
"""Indoor Flip Data.
...
@@ -57,12 +40,13 @@ class IndoorFlipData(object):
...
@@ -57,12 +40,13 @@ class IndoorFlipData(object):
def
__repr__
(
self
):
def
__repr__
(
self
):
repr_str
=
self
.
__class__
.
__name__
repr_str
=
self
.
__class__
.
__name__
repr_str
+=
'(flip_ratio={})'
.
format
(
self
.
flip_ratio
)
return
repr_str
return
repr_str
@
PIPELINES
.
register_module
()
@
PIPELINES
.
register_module
()
class
Indoor
Augme
ntColor
(
object
):
class
Indoor
Poi
nt
s
Color
Jitter
(
object
):
"""Indoor
Augme
nt Color.
"""Indoor
Poi
nt
s
Color
Jitter
.
Augment the color of points.
Augment the color of points.
...
@@ -143,6 +127,22 @@ class IndoorGlobalRotScale(object):
...
@@ -143,6 +127,22 @@ class IndoorGlobalRotScale(object):
self
.
rot_range
=
rot_range
self
.
rot_range
=
rot_range
self
.
scale_range
=
scale_range
self
.
scale_range
=
scale_range
def
_rotz
(
self
,
t
):
"""Rotate About Z.
Rotation about the z-axis.
Args:
t (float): Angle of rotation.
Returns:
rot_mat (ndarray): Matrix of rotation.
"""
c
=
np
.
cos
(
t
)
s
=
np
.
sin
(
t
)
rot_mat
=
np
.
array
([[
c
,
-
s
,
0
],
[
s
,
c
,
0
],
[
0
,
0
,
1
]])
return
rot_mat
def
_rotate_aligned_boxes
(
self
,
input_boxes
,
rot_mat
):
def
_rotate_aligned_boxes
(
self
,
input_boxes
,
rot_mat
):
"""Rotate Aligned Boxes.
"""Rotate Aligned Boxes.
...
@@ -183,15 +183,13 @@ class IndoorGlobalRotScale(object):
...
@@ -183,15 +183,13 @@ class IndoorGlobalRotScale(object):
if
self
.
rot_range
is
not
None
:
if
self
.
rot_range
is
not
None
:
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
=
_rotz
(
rot_angle
)
rot_mat
=
self
.
_rotz
(
rot_angle
)
points
[:,
0
:
3
]
=
np
.
dot
(
points
[:,
0
:
3
],
rot_mat
.
T
)
points
[:,
:
3
]
=
np
.
dot
(
points
[:,
:
3
],
rot_mat
.
T
)
if
name
==
'scannet'
:
if
name
==
'scannet'
:
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
:
gt_bboxes_3d
[:,
0
:
3
]
=
np
.
dot
(
gt_bboxes_3d
[:,
0
:
3
],
gt_bboxes_3d
[:,
:
3
]
=
np
.
dot
(
gt_bboxes_3d
[:,
:
3
],
rot_mat
.
T
)
np
.
transpose
(
rot_mat
))
gt_bboxes_3d
[:,
6
]
-=
rot_angle
gt_bboxes_3d
[:,
6
]
-=
rot_angle
if
self
.
scale_range
is
not
None
:
if
self
.
scale_range
is
not
None
:
...
@@ -199,8 +197,8 @@ class IndoorGlobalRotScale(object):
...
@@ -199,8 +197,8 @@ class IndoorGlobalRotScale(object):
scale_ratio
=
np
.
random
.
uniform
(
self
.
scale_range
[
0
],
scale_ratio
=
np
.
random
.
uniform
(
self
.
scale_range
[
0
],
self
.
scale_range
[
1
])
self
.
scale_range
[
1
])
scale_ratio
=
np
.
tile
(
scale_ratio
,
3
)[
None
,
...]
scale_ratio
=
np
.
tile
(
scale_ratio
,
3
)[
None
,
...]
points
[:,
0
:
3
]
*=
scale_ratio
points
[:,
:
3
]
*=
scale_ratio
gt_bboxes_3d
[:,
0
:
3
]
*=
scale_ratio
gt_bboxes_3d
[:,
:
3
]
*=
scale_ratio
gt_bboxes_3d
[:,
3
:
6
]
*=
scale_ratio
gt_bboxes_3d
[:,
3
:
6
]
*=
scale_ratio
if
self
.
use_height
:
if
self
.
use_height
:
points
[:,
-
1
]
*=
scale_ratio
[
0
,
0
]
points
[:,
-
1
]
*=
scale_ratio
[
0
,
0
]
...
...
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