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
96e853f3
Commit
96e853f3
authored
Dec 11, 2018
by
yhcao6
Browse files
update interface
parent
edc5e18b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
12 deletions
+15
-12
mmdet/core/bbox/samplers/base_sampler.py
mmdet/core/bbox/samplers/base_sampler.py
+7
-2
mmdet/core/bbox/samplers/ohem_sampler.py
mmdet/core/bbox/samplers/ohem_sampler.py
+4
-5
mmdet/core/bbox/samplers/random_sampler.py
mmdet/core/bbox/samplers/random_sampler.py
+3
-2
mmdet/models/detectors/two_stage.py
mmdet/models/detectors/two_stage.py
+1
-3
No files found.
mmdet/core/bbox/samplers/base_sampler.py
View file @
96e853f3
...
...
@@ -7,7 +7,8 @@ from .sampling_result import SamplingResult
class
BaseSampler
(
metaclass
=
ABCMeta
):
def
__init__
(
self
):
def
__init__
(
self
,
context
):
self
.
context
=
context
self
.
pos_sampler
=
self
self
.
neg_sampler
=
self
...
...
@@ -19,7 +20,11 @@ class BaseSampler(metaclass=ABCMeta):
def
_sample_neg
(
self
,
assign_result
,
num_expected
,
**
kwargs
):
pass
def
sample
(
self
,
assign_result
,
bboxes
,
gt_bboxes
,
gt_labels
=
None
,
def
sample
(
self
,
assign_result
,
bboxes
,
gt_bboxes
,
gt_labels
=
None
,
**
kwargs
):
"""Sample positive and negative bboxes.
...
...
mmdet/core/bbox/samplers/ohem_sampler.py
View file @
96e853f3
...
...
@@ -11,15 +11,14 @@ class OHEMSampler(BaseSampler):
pos_fraction
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
True
,
bbox_roi_extractor
=
None
,
bbox_head
=
None
):
super
(
OHEMSampler
,
self
).
__init__
()
context
=
None
):
super
(
OHEMSampler
,
self
).
__init__
(
context
)
self
.
num
=
num
self
.
pos_fraction
=
pos_fraction
self
.
neg_pos_ub
=
neg_pos_ub
self
.
add_gt_as_proposals
=
add_gt_as_proposals
self
.
bbox_roi_extractor
=
bbox_roi_extractor
self
.
bbox_head
=
bbox_head
self
.
bbox_roi_extractor
=
context
.
bbox_roi_extractor
self
.
bbox_head
=
context
.
bbox_head
def
hard_mining
(
self
,
inds
,
num_expected
,
bboxes
,
labels
,
feats
):
# hard mining from the gallery.
...
...
mmdet/core/bbox/samplers/random_sampler.py
View file @
96e853f3
...
...
@@ -10,8 +10,9 @@ class RandomSampler(BaseSampler):
num
,
pos_fraction
,
neg_pos_ub
=-
1
,
add_gt_as_proposals
=
True
):
super
(
RandomSampler
,
self
).
__init__
()
add_gt_as_proposals
=
True
,
context
=
None
):
super
(
RandomSampler
,
self
).
__init__
(
context
)
self
.
num
=
num
self
.
pos_fraction
=
pos_fraction
self
.
neg_pos_ub
=
neg_pos_ub
...
...
mmdet/models/detectors/two_stage.py
View file @
96e853f3
...
...
@@ -104,9 +104,7 @@ class TwoStageDetector(BaseDetector, RPNTestMixin, BBoxTestMixin,
if
self
.
with_bbox
or
self
.
with_mask
:
bbox_assigner
=
build_assigner
(
self
.
train_cfg
.
rcnn
.
assigner
)
bbox_sampler
=
build_sampler
(
self
.
train_cfg
.
rcnn
.
sampler
,
bbox_roi_extractor
=
self
.
bbox_roi_extractor
,
bbox_head
=
self
.
bbox_head
)
self
.
train_cfg
.
rcnn
.
sampler
,
context
=
self
)
num_imgs
=
img
.
size
(
0
)
assign_results
=
[]
sampling_results
=
[]
...
...
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