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
b6c10f5c
Unverified
Commit
b6c10f5c
authored
Feb 16, 2022
by
Wenhao Wu
Committed by
GitHub
Feb 16, 2022
Browse files
Fix PointRCNN bugs (#1224)
parent
2e8bda4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
configs/_base_/models/point_rcnn.py
configs/_base_/models/point_rcnn.py
+6
-3
mmdet3d/core/bbox/samplers/iou_neg_piecewise_sampler.py
mmdet3d/core/bbox/samplers/iou_neg_piecewise_sampler.py
+1
-3
mmdet3d/models/dense_heads/point_rpn_head.py
mmdet3d/models/dense_heads/point_rpn_head.py
+27
-2
No files found.
configs/_base_/models/point_rcnn.py
View file @
b6c10f5c
...
@@ -91,7 +91,8 @@ model = dict(
...
@@ -91,7 +91,8 @@ model = dict(
pos_iou_thr
=
0.55
,
pos_iou_thr
=
0.55
,
neg_iou_thr
=
0.55
,
neg_iou_thr
=
0.55
,
min_pos_iou
=
0.55
,
min_pos_iou
=
0.55
,
ignore_iof_thr
=-
1
),
ignore_iof_thr
=-
1
,
match_low_quality
=
False
),
dict
(
# for Pedestrian
dict
(
# for Pedestrian
type
=
'MaxIoUAssigner'
,
type
=
'MaxIoUAssigner'
,
iou_calculator
=
dict
(
iou_calculator
=
dict
(
...
@@ -99,7 +100,8 @@ model = dict(
...
@@ -99,7 +100,8 @@ model = dict(
pos_iou_thr
=
0.55
,
pos_iou_thr
=
0.55
,
neg_iou_thr
=
0.55
,
neg_iou_thr
=
0.55
,
min_pos_iou
=
0.55
,
min_pos_iou
=
0.55
,
ignore_iof_thr
=-
1
),
ignore_iof_thr
=-
1
,
match_low_quality
=
False
),
dict
(
# for Cyclist
dict
(
# for Cyclist
type
=
'MaxIoUAssigner'
,
type
=
'MaxIoUAssigner'
,
iou_calculator
=
dict
(
iou_calculator
=
dict
(
...
@@ -107,7 +109,8 @@ model = dict(
...
@@ -107,7 +109,8 @@ model = dict(
pos_iou_thr
=
0.55
,
pos_iou_thr
=
0.55
,
neg_iou_thr
=
0.55
,
neg_iou_thr
=
0.55
,
min_pos_iou
=
0.55
,
min_pos_iou
=
0.55
,
ignore_iof_thr
=-
1
)
ignore_iof_thr
=-
1
,
match_low_quality
=
False
)
],
],
sampler
=
dict
(
sampler
=
dict
(
type
=
'IoUNegPiecewiseSampler'
,
type
=
'IoUNegPiecewiseSampler'
,
...
...
mmdet3d/core/bbox/samplers/iou_neg_piecewise_sampler.py
View file @
b6c10f5c
...
@@ -60,9 +60,7 @@ class IoUNegPiecewiseSampler(RandomSampler):
...
@@ -60,9 +60,7 @@ class IoUNegPiecewiseSampler(RandomSampler):
if
neg_inds
.
numel
()
!=
0
:
if
neg_inds
.
numel
()
!=
0
:
neg_inds
=
neg_inds
.
squeeze
(
1
)
neg_inds
=
neg_inds
.
squeeze
(
1
)
if
len
(
neg_inds
)
<=
0
:
if
len
(
neg_inds
)
<=
0
:
raise
NotImplementedError
(
return
neg_inds
.
squeeze
(
1
)
'Not support sampling the negative samples when the length '
'of negative samples is 0'
)
else
:
else
:
neg_inds_choice
=
neg_inds
.
new_zeros
([
0
])
neg_inds_choice
=
neg_inds
.
new_zeros
([
0
])
extend_num
=
0
extend_num
=
0
...
...
mmdet3d/models/dense_heads/point_rpn_head.py
View file @
b6c10f5c
...
@@ -272,7 +272,8 @@ class PointRPNHead(BaseModule):
...
@@ -272,7 +272,8 @@ class PointRPNHead(BaseModule):
bbox3d
=
self
.
bbox_coder
.
decode
(
bbox_preds
[
b
],
points
[
b
,
...,
:
3
],
bbox3d
=
self
.
bbox_coder
.
decode
(
bbox_preds
[
b
],
points
[
b
,
...,
:
3
],
object_class
[
b
])
object_class
[
b
])
bbox_selected
,
score_selected
,
labels
,
cls_preds_selected
=
\
bbox_selected
,
score_selected
,
labels
,
cls_preds_selected
=
\
self
.
class_agnostic_nms
(
obj_scores
[
b
],
sem_scores
[
b
],
bbox3d
)
self
.
class_agnostic_nms
(
obj_scores
[
b
],
sem_scores
[
b
],
bbox3d
,
points
[
b
,
...,
:
3
],
input_metas
[
b
])
bbox
=
input_metas
[
b
][
'box_type_3d'
](
bbox
=
input_metas
[
b
][
'box_type_3d'
](
bbox_selected
.
clone
(),
bbox_selected
.
clone
(),
box_dim
=
bbox_selected
.
shape
[
-
1
],
box_dim
=
bbox_selected
.
shape
[
-
1
],
...
@@ -280,7 +281,8 @@ class PointRPNHead(BaseModule):
...
@@ -280,7 +281,8 @@ class PointRPNHead(BaseModule):
results
.
append
((
bbox
,
score_selected
,
labels
,
cls_preds_selected
))
results
.
append
((
bbox
,
score_selected
,
labels
,
cls_preds_selected
))
return
results
return
results
def
class_agnostic_nms
(
self
,
obj_scores
,
sem_scores
,
bbox
):
def
class_agnostic_nms
(
self
,
obj_scores
,
sem_scores
,
bbox
,
points
,
input_meta
):
"""Class agnostic nms.
"""Class agnostic nms.
Args:
Args:
...
@@ -298,6 +300,29 @@ class PointRPNHead(BaseModule):
...
@@ -298,6 +300,29 @@ class PointRPNHead(BaseModule):
else
:
else
:
nms_func
=
nms_normal_gpu
nms_func
=
nms_normal_gpu
num_bbox
=
bbox
.
shape
[
0
]
bbox
=
input_meta
[
'box_type_3d'
](
bbox
.
clone
(),
box_dim
=
bbox
.
shape
[
-
1
],
with_yaw
=
True
,
origin
=
(
0.5
,
0.5
,
0.5
))
if
isinstance
(
bbox
,
LiDARInstance3DBoxes
):
box_idx
=
bbox
.
points_in_boxes
(
points
)
box_indices
=
box_idx
.
new_zeros
([
num_bbox
+
1
])
box_idx
[
box_idx
==
-
1
]
=
num_bbox
box_indices
.
scatter_add_
(
0
,
box_idx
.
long
(),
box_idx
.
new_ones
(
box_idx
.
shape
))
box_indices
=
box_indices
[:
-
1
]
nonempty_box_mask
=
box_indices
>=
0
elif
isinstance
(
bbox
,
DepthInstance3DBoxes
):
box_indices
=
bbox
.
points_in_boxes
(
points
)
nonempty_box_mask
=
box_indices
.
T
.
sum
(
1
)
>=
0
else
:
raise
NotImplementedError
(
'Unsupported bbox type!'
)
bbox
=
bbox
.
tensor
[
nonempty_box_mask
]
if
self
.
test_cfg
.
score_thr
is
not
None
:
if
self
.
test_cfg
.
score_thr
is
not
None
:
score_thr
=
self
.
test_cfg
.
score_thr
score_thr
=
self
.
test_cfg
.
score_thr
keep
=
(
obj_scores
>=
score_thr
)
keep
=
(
obj_scores
>=
score_thr
)
...
...
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