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
ModelZoo
SOLOv2-pytorch
Commits
d7743255
Commit
d7743255
authored
Oct 10, 2018
by
pangjm
Browse files
revise fast test & fix aug test bug
parent
35cec766
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
12 deletions
+38
-12
mmdet/models/detectors/fast_rcnn.py
mmdet/models/detectors/fast_rcnn.py
+30
-9
mmdet/models/detectors/test_mixins.py
mmdet/models/detectors/test_mixins.py
+7
-2
mmdet/models/detectors/two_stage.py
mmdet/models/detectors/two_stage.py
+1
-1
No files found.
mmdet/models/detectors/fast_rcnn.py
View file @
d7743255
...
@@ -23,3 +23,24 @@ class FastRCNN(TwoStageDetector):
...
@@ -23,3 +23,24 @@ class FastRCNN(TwoStageDetector):
mask_roi_extractor
=
mask_roi_extractor
,
mask_roi_extractor
=
mask_roi_extractor
,
mask_head
=
mask_head
,
mask_head
=
mask_head
,
pretrained
=
pretrained
)
pretrained
=
pretrained
)
def
forward_test
(
self
,
imgs
,
img_metas
,
proposals
,
**
kwargs
):
for
var
,
name
in
[(
imgs
,
'imgs'
),
(
img_metas
,
'img_metas'
)]:
if
not
isinstance
(
var
,
list
):
raise
TypeError
(
'{} must be a list, but got {}'
.
format
(
name
,
type
(
var
)))
num_augs
=
len
(
imgs
)
if
num_augs
!=
len
(
img_metas
):
raise
ValueError
(
'num of augmentations ({}) != num of image meta ({})'
.
format
(
len
(
imgs
),
len
(
img_metas
)))
# TODO: remove the restriction of imgs_per_gpu == 1 when prepared
imgs_per_gpu
=
imgs
[
0
].
size
(
0
)
assert
imgs_per_gpu
==
1
if
num_augs
==
1
:
return
self
.
simple_test
(
imgs
[
0
],
img_metas
[
0
],
proposals
[
0
],
**
kwargs
)
else
:
return
self
.
aug_test
(
imgs
,
img_metas
,
proposals
,
**
kwargs
)
mmdet/models/detectors/test_mixins.py
View file @
d7743255
...
@@ -135,6 +135,11 @@ class MaskTestMixin(object):
...
@@ -135,6 +135,11 @@ class MaskTestMixin(object):
ori_shape
=
img_metas
[
0
][
0
][
'ori_shape'
]
ori_shape
=
img_metas
[
0
][
0
][
'ori_shape'
]
segm_result
=
self
.
mask_head
.
get_seg_masks
(
segm_result
=
self
.
mask_head
.
get_seg_masks
(
merged_masks
,
det_bboxes
,
det_labels
,
self
.
test_cfg
.
rcnn
,
merged_masks
,
ori_shape
)
det_bboxes
,
det_labels
,
self
.
test_cfg
.
rcnn
,
ori_shape
,
scale_factor
=
1.0
,
rescale
=
False
)
return
segm_result
return
segm_result
mmdet/models/detectors/two_stage.py
View file @
d7743255
...
@@ -147,7 +147,7 @@ class TwoStageDetector(BaseDetector, RPNTestMixin, BBoxTestMixin,
...
@@ -147,7 +147,7 @@ class TwoStageDetector(BaseDetector, RPNTestMixin, BBoxTestMixin,
proposal_list
=
self
.
simple_test_rpn
(
proposal_list
=
self
.
simple_test_rpn
(
x
,
img_meta
,
x
,
img_meta
,
self
.
test_cfg
.
rpn
)
if
proposals
is
None
else
proposals
[
0
]
self
.
test_cfg
.
rpn
)
if
proposals
is
None
else
proposals
det_bboxes
,
det_labels
=
self
.
simple_test_bboxes
(
det_bboxes
,
det_labels
=
self
.
simple_test_bboxes
(
x
,
img_meta
,
proposal_list
,
self
.
test_cfg
.
rcnn
,
rescale
=
rescale
)
x
,
img_meta
,
proposal_list
,
self
.
test_cfg
.
rcnn
,
rescale
=
rescale
)
...
...
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