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
62d7210f
Commit
62d7210f
authored
May 02, 2020
by
wuyuefeng
Browse files
little changes
parent
6aa820ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
53 deletions
+14
-53
mmdet3d/models/middle_encoders/sparse_unet.py
mmdet3d/models/middle_encoders/sparse_unet.py
+5
-10
mmdet3d/ops/sparse_block.py
mmdet3d/ops/sparse_block.py
+1
-3
tests/test_roiaware_pool3d.py
tests/test_roiaware_pool3d.py
+8
-40
No files found.
mmdet3d/models/middle_encoders/sparse_unet.py
View file @
62d7210f
...
@@ -224,8 +224,7 @@ class SparseUNet(nn.Module):
...
@@ -224,8 +224,7 @@ class SparseUNet(nn.Module):
kernel_size
,
kernel_size
,
padding
=
padding
,
padding
=
padding
,
bias
=
False
,
bias
=
False
,
indice_key
=
indice_key
),
indice_key
=
indice_key
))
)
elif
conv_type
==
'spconv'
:
elif
conv_type
==
'spconv'
:
m
=
spconv
.
SparseSequential
(
m
=
spconv
.
SparseSequential
(
build_norm_layer
(
norm_cfg
,
in_channels
)[
1
],
build_norm_layer
(
norm_cfg
,
in_channels
)[
1
],
...
@@ -237,8 +236,7 @@ class SparseUNet(nn.Module):
...
@@ -237,8 +236,7 @@ class SparseUNet(nn.Module):
stride
=
stride
,
stride
=
stride
,
padding
=
padding
,
padding
=
padding
,
bias
=
False
,
bias
=
False
,
indice_key
=
indice_key
),
indice_key
=
indice_key
))
)
elif
conv_type
==
'inverseconv'
:
elif
conv_type
==
'inverseconv'
:
m
=
spconv
.
SparseSequential
(
m
=
spconv
.
SparseSequential
(
build_norm_layer
(
norm_cfg
,
in_channels
)[
1
],
build_norm_layer
(
norm_cfg
,
in_channels
)[
1
],
...
@@ -248,8 +246,7 @@ class SparseUNet(nn.Module):
...
@@ -248,8 +246,7 @@ class SparseUNet(nn.Module):
out_channels
,
out_channels
,
kernel_size
,
kernel_size
,
bias
=
False
,
bias
=
False
,
indice_key
=
indice_key
),
indice_key
=
indice_key
))
)
else
:
else
:
raise
NotImplementedError
raise
NotImplementedError
return
m
return
m
...
@@ -290,8 +287,7 @@ class SparseUNet(nn.Module):
...
@@ -290,8 +287,7 @@ class SparseUNet(nn.Module):
bias
=
False
,
bias
=
False
,
indice_key
=
indice_key
),
indice_key
=
indice_key
),
build_norm_layer
(
norm_cfg
,
out_channels
)[
1
],
build_norm_layer
(
norm_cfg
,
out_channels
)[
1
],
nn
.
ReLU
(
inplace
=
True
),
nn
.
ReLU
(
inplace
=
True
))
)
elif
conv_type
==
'spconv'
:
elif
conv_type
==
'spconv'
:
m
=
spconv
.
SparseSequential
(
m
=
spconv
.
SparseSequential
(
spconv
.
SparseConv3d
(
spconv
.
SparseConv3d
(
...
@@ -303,8 +299,7 @@ class SparseUNet(nn.Module):
...
@@ -303,8 +299,7 @@ class SparseUNet(nn.Module):
bias
=
False
,
bias
=
False
,
indice_key
=
indice_key
),
indice_key
=
indice_key
),
build_norm_layer
(
norm_cfg
,
out_channels
)[
1
],
build_norm_layer
(
norm_cfg
,
out_channels
)[
1
],
nn
.
ReLU
(
inplace
=
True
),
nn
.
ReLU
(
inplace
=
True
))
)
elif
conv_type
==
'inverseconv'
:
elif
conv_type
==
'inverseconv'
:
m
=
spconv
.
SparseSequential
(
m
=
spconv
.
SparseSequential
(
spconv
.
SparseInverseConv3d
(
spconv
.
SparseInverseConv3d
(
...
...
mmdet3d/ops/sparse_block.py
View file @
62d7210f
...
@@ -5,9 +5,7 @@ from mmdet.models.backbones.resnet import BasicBlock, Bottleneck
...
@@ -5,9 +5,7 @@ from mmdet.models.backbones.resnet import BasicBlock, Bottleneck
from
mmdet.ops
import
build_norm_layer
from
mmdet.ops
import
build_norm_layer
from
mmdet.ops.conv
import
conv_cfg
from
mmdet.ops.conv
import
conv_cfg
conv_cfg
.
update
({
conv_cfg
.
update
({
'SubMConv3d'
:
spconv
.
SubMConv3d
})
'SubMConv3d'
:
spconv
.
SubMConv3d
,
})
def
conv3x3
(
in_planes
,
out_planes
,
stride
=
1
,
indice_key
=
None
):
def
conv3x3
(
in_planes
,
out_planes
,
stride
=
1
,
indice_key
=
None
):
...
...
tests/test_roiaware_pool3d.py
View file @
62d7210f
...
@@ -19,23 +19,10 @@ def test_RoIAwarePool3d():
...
@@ -19,23 +19,10 @@ def test_RoIAwarePool3d():
dtype
=
torch
.
float32
).
cuda
(
dtype
=
torch
.
float32
).
cuda
(
)
# boxes (m, 7) with bottom center in lidar coordinate
)
# boxes (m, 7) with bottom center in lidar coordinate
pts
=
torch
.
tensor
(
pts
=
torch
.
tensor
(
[
[[
1
,
2
,
3.3
],
[
1.2
,
2.5
,
3.0
],
[
0.8
,
2.1
,
3.5
],
[
1.6
,
2.6
,
3.6
],
[
1
,
2
,
3.3
],
[
0.8
,
1.2
,
3.9
],
[
-
9.2
,
21.0
,
18.2
],
[
3.8
,
7.9
,
6.3
],
[
1.2
,
2.5
,
3.0
],
[
4.7
,
3.5
,
-
12.2
],
[
3.8
,
7.6
,
-
2
],
[
-
10.6
,
-
12.9
,
-
20
],
[
-
16
,
-
18
,
9
],
[
0.8
,
2.1
,
3.5
],
[
-
21.3
,
-
52
,
-
5
],
[
0
,
0
,
0
],
[
6
,
7
,
8
],
[
-
2
,
-
3
,
-
4
]],
[
1.6
,
2.6
,
3.6
],
[
0.8
,
1.2
,
3.9
],
[
-
9.2
,
21.0
,
18.2
],
[
3.8
,
7.9
,
6.3
],
[
4.7
,
3.5
,
-
12.2
],
[
3.8
,
7.6
,
-
2
],
[
-
10.6
,
-
12.9
,
-
20
],
[
-
16
,
-
18
,
9
],
[
-
21.3
,
-
52
,
-
5
],
[
0
,
0
,
0
],
[
6
,
7
,
8
],
[
-
2
,
-
3
,
-
4
],
],
dtype
=
torch
.
float32
).
cuda
()
# points (n, 3) in lidar coordinate
dtype
=
torch
.
float32
).
cuda
()
# points (n, 3) in lidar coordinate
pts_feature
=
pts
.
clone
()
pts_feature
=
pts
.
clone
()
...
@@ -83,23 +70,10 @@ def test_points_in_boxes_cpu():
...
@@ -83,23 +70,10 @@ def test_points_in_boxes_cpu():
dtype
=
torch
.
float32
dtype
=
torch
.
float32
)
# boxes (m, 7) with bottom center in lidar coordinate
)
# boxes (m, 7) with bottom center in lidar coordinate
pts
=
torch
.
tensor
(
pts
=
torch
.
tensor
(
[
[[
1
,
2
,
3.3
],
[
1.2
,
2.5
,
3.0
],
[
0.8
,
2.1
,
3.5
],
[
1.6
,
2.6
,
3.6
],
[
1
,
2
,
3.3
],
[
0.8
,
1.2
,
3.9
],
[
-
9.2
,
21.0
,
18.2
],
[
3.8
,
7.9
,
6.3
],
[
1.2
,
2.5
,
3.0
],
[
4.7
,
3.5
,
-
12.2
],
[
3.8
,
7.6
,
-
2
],
[
-
10.6
,
-
12.9
,
-
20
],
[
-
16
,
-
18
,
9
],
[
0.8
,
2.1
,
3.5
],
[
-
21.3
,
-
52
,
-
5
],
[
0
,
0
,
0
],
[
6
,
7
,
8
],
[
-
2
,
-
3
,
-
4
]],
[
1.6
,
2.6
,
3.6
],
[
0.8
,
1.2
,
3.9
],
[
-
9.2
,
21.0
,
18.2
],
[
3.8
,
7.9
,
6.3
],
[
4.7
,
3.5
,
-
12.2
],
[
3.8
,
7.6
,
-
2
],
[
-
10.6
,
-
12.9
,
-
20
],
[
-
16
,
-
18
,
9
],
[
-
21.3
,
-
52
,
-
5
],
[
0
,
0
,
0
],
[
6
,
7
,
8
],
[
-
2
,
-
3
,
-
4
],
],
dtype
=
torch
.
float32
)
# points (n, 3) in lidar coordinate
dtype
=
torch
.
float32
)
# points (n, 3) in lidar coordinate
point_indices
=
points_in_boxes_cpu
(
points
=
pts
,
boxes
=
boxes
)
point_indices
=
points_in_boxes_cpu
(
points
=
pts
,
boxes
=
boxes
)
...
@@ -109,9 +83,3 @@ def test_points_in_boxes_cpu():
...
@@ -109,9 +83,3 @@ def test_points_in_boxes_cpu():
dtype
=
torch
.
int32
)
dtype
=
torch
.
int32
)
assert
point_indices
.
shape
==
torch
.
Size
([
2
,
15
])
assert
point_indices
.
shape
==
torch
.
Size
([
2
,
15
])
assert
(
point_indices
==
expected_point_indices
).
all
()
assert
(
point_indices
==
expected_point_indices
).
all
()
if
__name__
==
'__main__'
:
test_points_in_boxes_cpu
()
test_points_in_boxes_gpu
()
test_RoIAwarePool3d
()
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