Skip to content

Commit 405c377

Browse files
authored
Move train_cfg/test_cfg into model (open-mmlab#4347)
* Move train_cfg/test_cfg into model * fixed fsaf * fixed missing
1 parent c3968eb commit 405c377

File tree

85 files changed

+1516
-1513
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1516
-1513
lines changed

.dev_scripts/batch_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ def main():
157157
shuffle=False)
158158

159159
# build the model and load checkpoint
160-
model = build_detector(
161-
cfg.model, train_cfg=None, test_cfg=cfg.test_cfg)
160+
cfg.model.train_cfg = None
161+
model = build_detector(cfg.model, test_cfg=cfg.get('test_cfg'))
162162
fp16_cfg = cfg.get('fp16', None)
163163
if fp16_cfg is not None:
164164
wrap_fp16_model(model)

configs/_base_/models/cascade_mask_rcnn_r50_fpn.py

+85-85
Original file line numberDiff line numberDiff line change
@@ -105,96 +105,96 @@
105105
conv_out_channels=256,
106106
num_classes=80,
107107
loss_mask=dict(
108-
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0))))
109-
# model training and testing settings
110-
train_cfg = dict(
111-
rpn=dict(
112-
assigner=dict(
113-
type='MaxIoUAssigner',
114-
pos_iou_thr=0.7,
115-
neg_iou_thr=0.3,
116-
min_pos_iou=0.3,
117-
match_low_quality=True,
118-
ignore_iof_thr=-1),
119-
sampler=dict(
120-
type='RandomSampler',
121-
num=256,
122-
pos_fraction=0.5,
123-
neg_pos_ub=-1,
124-
add_gt_as_proposals=False),
125-
allowed_border=0,
126-
pos_weight=-1,
127-
debug=False),
128-
rpn_proposal=dict(
129-
nms_across_levels=False,
130-
nms_pre=2000,
131-
nms_post=2000,
132-
max_num=2000,
133-
nms_thr=0.7,
134-
min_bbox_size=0),
135-
rcnn=[
136-
dict(
137-
assigner=dict(
138-
type='MaxIoUAssigner',
139-
pos_iou_thr=0.5,
140-
neg_iou_thr=0.5,
141-
min_pos_iou=0.5,
142-
match_low_quality=False,
143-
ignore_iof_thr=-1),
144-
sampler=dict(
145-
type='RandomSampler',
146-
num=512,
147-
pos_fraction=0.25,
148-
neg_pos_ub=-1,
149-
add_gt_as_proposals=True),
150-
mask_size=28,
151-
pos_weight=-1,
152-
debug=False),
153-
dict(
154-
assigner=dict(
155-
type='MaxIoUAssigner',
156-
pos_iou_thr=0.6,
157-
neg_iou_thr=0.6,
158-
min_pos_iou=0.6,
159-
match_low_quality=False,
160-
ignore_iof_thr=-1),
161-
sampler=dict(
162-
type='RandomSampler',
163-
num=512,
164-
pos_fraction=0.25,
165-
neg_pos_ub=-1,
166-
add_gt_as_proposals=True),
167-
mask_size=28,
168-
pos_weight=-1,
169-
debug=False),
170-
dict(
108+
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0))),
109+
# model training and testing settings
110+
train_cfg=dict(
111+
rpn=dict(
171112
assigner=dict(
172113
type='MaxIoUAssigner',
173114
pos_iou_thr=0.7,
174-
neg_iou_thr=0.7,
175-
min_pos_iou=0.7,
176-
match_low_quality=False,
115+
neg_iou_thr=0.3,
116+
min_pos_iou=0.3,
117+
match_low_quality=True,
177118
ignore_iof_thr=-1),
178119
sampler=dict(
179120
type='RandomSampler',
180-
num=512,
181-
pos_fraction=0.25,
121+
num=256,
122+
pos_fraction=0.5,
182123
neg_pos_ub=-1,
183-
add_gt_as_proposals=True),
184-
mask_size=28,
124+
add_gt_as_proposals=False),
125+
allowed_border=0,
185126
pos_weight=-1,
186-
debug=False)
187-
])
188-
test_cfg = dict(
189-
rpn=dict(
190-
nms_across_levels=False,
191-
nms_pre=1000,
192-
nms_post=1000,
193-
max_num=1000,
194-
nms_thr=0.7,
195-
min_bbox_size=0),
196-
rcnn=dict(
197-
score_thr=0.05,
198-
nms=dict(type='nms', iou_threshold=0.5),
199-
max_per_img=100,
200-
mask_thr_binary=0.5))
127+
debug=False),
128+
rpn_proposal=dict(
129+
nms_across_levels=False,
130+
nms_pre=2000,
131+
nms_post=2000,
132+
max_num=2000,
133+
nms_thr=0.7,
134+
min_bbox_size=0),
135+
rcnn=[
136+
dict(
137+
assigner=dict(
138+
type='MaxIoUAssigner',
139+
pos_iou_thr=0.5,
140+
neg_iou_thr=0.5,
141+
min_pos_iou=0.5,
142+
match_low_quality=False,
143+
ignore_iof_thr=-1),
144+
sampler=dict(
145+
type='RandomSampler',
146+
num=512,
147+
pos_fraction=0.25,
148+
neg_pos_ub=-1,
149+
add_gt_as_proposals=True),
150+
mask_size=28,
151+
pos_weight=-1,
152+
debug=False),
153+
dict(
154+
assigner=dict(
155+
type='MaxIoUAssigner',
156+
pos_iou_thr=0.6,
157+
neg_iou_thr=0.6,
158+
min_pos_iou=0.6,
159+
match_low_quality=False,
160+
ignore_iof_thr=-1),
161+
sampler=dict(
162+
type='RandomSampler',
163+
num=512,
164+
pos_fraction=0.25,
165+
neg_pos_ub=-1,
166+
add_gt_as_proposals=True),
167+
mask_size=28,
168+
pos_weight=-1,
169+
debug=False),
170+
dict(
171+
assigner=dict(
172+
type='MaxIoUAssigner',
173+
pos_iou_thr=0.7,
174+
neg_iou_thr=0.7,
175+
min_pos_iou=0.7,
176+
match_low_quality=False,
177+
ignore_iof_thr=-1),
178+
sampler=dict(
179+
type='RandomSampler',
180+
num=512,
181+
pos_fraction=0.25,
182+
neg_pos_ub=-1,
183+
add_gt_as_proposals=True),
184+
mask_size=28,
185+
pos_weight=-1,
186+
debug=False)
187+
]),
188+
test_cfg=dict(
189+
rpn=dict(
190+
nms_across_levels=False,
191+
nms_pre=1000,
192+
nms_post=1000,
193+
max_num=1000,
194+
nms_thr=0.7,
195+
min_bbox_size=0),
196+
rcnn=dict(
197+
score_thr=0.05,
198+
nms=dict(type='nms', iou_threshold=0.5),
199+
max_per_img=100,
200+
mask_thr_binary=0.5)))

configs/_base_/models/cascade_rcnn_r50_fpn.py

+81-81
Original file line numberDiff line numberDiff line change
@@ -92,92 +92,92 @@
9292
use_sigmoid=False,
9393
loss_weight=1.0),
9494
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))
95-
]))
96-
# model training and testing settings
97-
train_cfg = dict(
98-
rpn=dict(
99-
assigner=dict(
100-
type='MaxIoUAssigner',
101-
pos_iou_thr=0.7,
102-
neg_iou_thr=0.3,
103-
min_pos_iou=0.3,
104-
match_low_quality=True,
105-
ignore_iof_thr=-1),
106-
sampler=dict(
107-
type='RandomSampler',
108-
num=256,
109-
pos_fraction=0.5,
110-
neg_pos_ub=-1,
111-
add_gt_as_proposals=False),
112-
allowed_border=0,
113-
pos_weight=-1,
114-
debug=False),
115-
rpn_proposal=dict(
116-
nms_across_levels=False,
117-
nms_pre=2000,
118-
nms_post=2000,
119-
max_num=2000,
120-
nms_thr=0.7,
121-
min_bbox_size=0),
122-
rcnn=[
123-
dict(
124-
assigner=dict(
125-
type='MaxIoUAssigner',
126-
pos_iou_thr=0.5,
127-
neg_iou_thr=0.5,
128-
min_pos_iou=0.5,
129-
match_low_quality=False,
130-
ignore_iof_thr=-1),
131-
sampler=dict(
132-
type='RandomSampler',
133-
num=512,
134-
pos_fraction=0.25,
135-
neg_pos_ub=-1,
136-
add_gt_as_proposals=True),
137-
pos_weight=-1,
138-
debug=False),
139-
dict(
140-
assigner=dict(
141-
type='MaxIoUAssigner',
142-
pos_iou_thr=0.6,
143-
neg_iou_thr=0.6,
144-
min_pos_iou=0.6,
145-
match_low_quality=False,
146-
ignore_iof_thr=-1),
147-
sampler=dict(
148-
type='RandomSampler',
149-
num=512,
150-
pos_fraction=0.25,
151-
neg_pos_ub=-1,
152-
add_gt_as_proposals=True),
153-
pos_weight=-1,
154-
debug=False),
155-
dict(
95+
]),
96+
# model training and testing settings
97+
train_cfg=dict(
98+
rpn=dict(
15699
assigner=dict(
157100
type='MaxIoUAssigner',
158101
pos_iou_thr=0.7,
159-
neg_iou_thr=0.7,
160-
min_pos_iou=0.7,
161-
match_low_quality=False,
102+
neg_iou_thr=0.3,
103+
min_pos_iou=0.3,
104+
match_low_quality=True,
162105
ignore_iof_thr=-1),
163106
sampler=dict(
164107
type='RandomSampler',
165-
num=512,
166-
pos_fraction=0.25,
108+
num=256,
109+
pos_fraction=0.5,
167110
neg_pos_ub=-1,
168-
add_gt_as_proposals=True),
111+
add_gt_as_proposals=False),
112+
allowed_border=0,
169113
pos_weight=-1,
170-
debug=False)
171-
])
172-
test_cfg = dict(
173-
rpn=dict(
174-
nms_across_levels=False,
175-
nms_pre=1000,
176-
nms_post=1000,
177-
max_num=1000,
178-
nms_thr=0.7,
179-
min_bbox_size=0),
180-
rcnn=dict(
181-
score_thr=0.05,
182-
nms=dict(type='nms', iou_threshold=0.5),
183-
max_per_img=100))
114+
debug=False),
115+
rpn_proposal=dict(
116+
nms_across_levels=False,
117+
nms_pre=2000,
118+
nms_post=2000,
119+
max_num=2000,
120+
nms_thr=0.7,
121+
min_bbox_size=0),
122+
rcnn=[
123+
dict(
124+
assigner=dict(
125+
type='MaxIoUAssigner',
126+
pos_iou_thr=0.5,
127+
neg_iou_thr=0.5,
128+
min_pos_iou=0.5,
129+
match_low_quality=False,
130+
ignore_iof_thr=-1),
131+
sampler=dict(
132+
type='RandomSampler',
133+
num=512,
134+
pos_fraction=0.25,
135+
neg_pos_ub=-1,
136+
add_gt_as_proposals=True),
137+
pos_weight=-1,
138+
debug=False),
139+
dict(
140+
assigner=dict(
141+
type='MaxIoUAssigner',
142+
pos_iou_thr=0.6,
143+
neg_iou_thr=0.6,
144+
min_pos_iou=0.6,
145+
match_low_quality=False,
146+
ignore_iof_thr=-1),
147+
sampler=dict(
148+
type='RandomSampler',
149+
num=512,
150+
pos_fraction=0.25,
151+
neg_pos_ub=-1,
152+
add_gt_as_proposals=True),
153+
pos_weight=-1,
154+
debug=False),
155+
dict(
156+
assigner=dict(
157+
type='MaxIoUAssigner',
158+
pos_iou_thr=0.7,
159+
neg_iou_thr=0.7,
160+
min_pos_iou=0.7,
161+
match_low_quality=False,
162+
ignore_iof_thr=-1),
163+
sampler=dict(
164+
type='RandomSampler',
165+
num=512,
166+
pos_fraction=0.25,
167+
neg_pos_ub=-1,
168+
add_gt_as_proposals=True),
169+
pos_weight=-1,
170+
debug=False)
171+
]),
172+
test_cfg=dict(
173+
rpn=dict(
174+
nms_across_levels=False,
175+
nms_pre=1000,
176+
nms_post=1000,
177+
max_num=1000,
178+
nms_thr=0.7,
179+
min_bbox_size=0),
180+
rcnn=dict(
181+
score_thr=0.05,
182+
nms=dict(type='nms', iou_threshold=0.5),
183+
max_per_img=100)))

0 commit comments

Comments
 (0)