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
48fd72ff
Unverified
Commit
48fd72ff
authored
Sep 13, 2023
by
Xiang Xu
Committed by
GitHub
Sep 13, 2023
Browse files
[Fix] Fix potential bug in lasermix (#2710)
parent
c642055f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
mmdet3d/datasets/transforms/transforms_3d.py
mmdet3d/datasets/transforms/transforms_3d.py
+11
-8
No files found.
mmdet3d/datasets/transforms/transforms_3d.py
View file @
48fd72ff
...
...
@@ -2604,26 +2604,29 @@ class LaserMix(BaseTransform):
points
=
input_dict
[
'points'
]
pts_semantic_mask
=
input_dict
[
'pts_semantic_mask'
]
# convert angle to radian
pitch_angle_down
=
self
.
pitch_angles
[
0
]
/
180
*
np
.
pi
pitch_angle_up
=
self
.
pitch_angles
[
1
]
/
180
*
np
.
pi
rho
=
torch
.
sqrt
(
points
.
coord
[:,
0
]
**
2
+
points
.
coord
[:,
1
]
**
2
)
pitch
=
torch
.
atan2
(
points
.
coord
[:,
2
],
rho
)
pitch
=
torch
.
clamp
(
pitch
,
self
.
pitch_angle
s
[
0
]
+
1e-5
,
self
.
pitch_angle
s
[
1
]
-
1e-5
)
pitch
=
torch
.
clamp
(
pitch
,
pitch_angle
_down
+
1e-5
,
pitch_angle
_up
-
1e-5
)
mix_rho
=
torch
.
sqrt
(
mix_points
.
coord
[:,
0
]
**
2
+
mix_points
.
coord
[:,
1
]
**
2
)
mix_pitch
=
torch
.
atan2
(
mix_points
.
coord
[:,
2
],
mix_rho
)
mix_pitch
=
torch
.
clamp
(
mix_pitch
,
self
.
pitch_angle
s
[
0
]
+
1e-5
,
self
.
pitch_angle
s
[
1
]
-
1e-5
)
mix_pitch
=
torch
.
clamp
(
mix_pitch
,
pitch_angle
_down
+
1e-5
,
pitch_angle
_up
-
1e-5
)
num_areas
=
np
.
random
.
choice
(
self
.
num_areas
,
size
=
1
)[
0
]
angle_list
=
np
.
linspace
(
self
.
pitch_angle
s
[
1
],
self
.
pitch_angle
s
[
0
]
,
angle_list
=
np
.
linspace
(
pitch_angle
_up
,
pitch_angle
_down
,
num_areas
+
1
)
out_points
=
[]
out_pts_semantic_mask
=
[]
for
i
in
range
(
num_areas
):
# convert angle to radian
start_angle
=
angle_list
[
i
+
1
]
/
180
*
np
.
pi
end_angle
=
angle_list
[
i
]
/
180
*
np
.
pi
start_angle
=
angle_list
[
i
+
1
]
end_angle
=
angle_list
[
i
]
if
i
%
2
==
0
:
# pick from original point cloud
idx
=
(
pitch
>
start_angle
)
&
(
pitch
<=
end_angle
)
out_points
.
append
(
points
[
idx
])
...
...
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