Skip to content

Commit

Permalink
refactor nms config (open-mmlab#4636)
Browse files Browse the repository at this point in the history
* rpn head refactor

* guided anchor

* add deprecate warning

* add more warning for set ori augs

* fix unitest

* change base

* cascade rpn

* cornernet and centri

* grid frcnn ok

* ga anchor ok

* legacy ok

* pisa ok

* tridnet ok

* fix tutorals

* use ConfigDict
  • Loading branch information
jshilong authored Feb 25, 2021
1 parent 6215cc1 commit edaf241
Show file tree
Hide file tree
Showing 35 changed files with 228 additions and 164 deletions.
12 changes: 4 additions & 8 deletions configs/_base_/models/cascade_mask_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,9 @@
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=2000,
max_num=2000,
nms_thr=0.7,
max_per_img=2000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=[
dict(
Expand Down Expand Up @@ -187,11 +185,9 @@
]),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=1000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
Expand Down
12 changes: 4 additions & 8 deletions configs/_base_/models/cascade_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=2000,
max_num=2000,
nms_thr=0.7,
max_per_img=2000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=[
dict(
Expand Down Expand Up @@ -171,11 +169,9 @@
]),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=1000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
Expand Down
12 changes: 4 additions & 8 deletions configs/_base_/models/faster_rcnn_r50_caffe_c4.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=12000,
nms_post=2000,
max_num=2000,
nms_thr=0.7,
max_per_img=2000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
assigner=dict(
Expand All @@ -104,11 +102,9 @@
debug=False)),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=6000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
Expand Down
12 changes: 4 additions & 8 deletions configs/_base_/models/faster_rcnn_r50_caffe_dc5.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=12000,
nms_post=2000,
max_num=2000,
nms_thr=0.7,
max_per_img=2000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
assigner=dict(
Expand All @@ -95,11 +93,9 @@
debug=False)),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms=dict(type='nms', iou_threshold=0.7),
nms_pre=6000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
Expand Down
12 changes: 4 additions & 8 deletions configs/_base_/models/faster_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
assigner=dict(
Expand All @@ -96,11 +94,9 @@
debug=False)),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=1000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
Expand Down
12 changes: 4 additions & 8 deletions configs/_base_/models/mask_rcnn_r50_caffe_c4.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=12000,
nms_post=2000,
max_num=2000,
nms_thr=0.7,
max_per_img=2000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
assigner=dict(
Expand All @@ -114,11 +112,9 @@
debug=False)),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=6000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
nms=dict(type='nms', iou_threshold=0.7),
max_per_img=1000,
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
Expand Down
12 changes: 4 additions & 8 deletions configs/_base_/models/mask_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
assigner=dict(
Expand All @@ -111,11 +109,9 @@
debug=False)),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=1000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
Expand Down
6 changes: 2 additions & 4 deletions configs/_base_/models/rpn_r50_caffe_c4.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
debug=False)),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=12000,
nms_post=2000,
max_num=2000,
nms_thr=0.7,
max_per_img=2000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0)))
7 changes: 3 additions & 4 deletions configs/_base_/models/rpn_r50_fpn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# model settings

model = dict(
type='RPN',
pretrained='torchvision://resnet50',
Expand Down Expand Up @@ -52,9 +53,7 @@
debug=False)),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0)))
5 changes: 3 additions & 2 deletions configs/cascade_rpn/crpn_faster_rcnn_r50_caffe_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@
pos_weight=-1,
debug=False)
],
rpn_proposal=dict(max_num=300, nms_thr=0.8),
rpn_proposal=dict(max_per_img=300, nms=dict(iou_threshold=0.8)),
rcnn=dict(
assigner=dict(
pos_iou_thr=0.65, neg_iou_thr=0.65, min_pos_iou=0.65),
sampler=dict(type='RandomSampler', num=256))),
test_cfg=dict(
rpn=dict(max_num=300, nms_thr=0.8), rcnn=dict(score_thr=1e-3)))
rpn=dict(max_per_img=300, nms=dict(iou_threshold=0.8)),
rcnn=dict(score_thr=1e-3)))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
6 changes: 2 additions & 4 deletions configs/cascade_rpn/crpn_r50_caffe_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,9 @@
]),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=2000,
max_num=2000,
nms_thr=0.8,
max_per_img=2000,
nms=dict(type='nms', iou_threshold=0.8),
min_bbox_size=0)))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
distance_threshold=0.5,
score_thr=0.05,
max_per_img=100,
nms_cfg=dict(type='soft_nms', iou_threshold=0.5, method='gaussian')))
nms=dict(type='soft_nms', iou_threshold=0.5, method='gaussian')))
# data settings
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
distance_threshold=0.5,
score_thr=0.05,
max_per_img=100,
nms_cfg=dict(type='soft_nms', iou_threshold=0.5, method='gaussian')))
nms=dict(type='soft_nms', iou_threshold=0.5, method='gaussian')))
# data settings
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
distance_threshold=0.5,
score_thr=0.05,
max_per_img=100,
nms_cfg=dict(type='soft_nms', iou_threshold=0.5, method='gaussian')))
nms=dict(type='soft_nms', iou_threshold=0.5, method='gaussian')))
# data settings
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
distance_threshold=0.5,
score_thr=0.05,
max_per_img=100,
nms_cfg=dict(type='soft_nms', iou_threshold=0.5, method='gaussian')))
nms=dict(type='soft_nms', iou_threshold=0.5, method='gaussian')))
# data settings
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
Expand Down
4 changes: 2 additions & 2 deletions configs/dynamic_rcnn/dynamic_rcnn_r50_fpn_1x.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))),
train_cfg=dict(
rpn_proposal=dict(nms_thr=0.85),
rpn_proposal=dict(nms=dict(iou_threshold=0.85)),
rcnn=dict(
dynamic_rcnn=dict(
iou_topk=75,
beta_topk=10,
update_iter_interval=100,
initial_iou=0.4,
initial_beta=1.0))),
test_cfg=dict(rpn=dict(nms_thr=0.85)))
test_cfg=dict(rpn=dict(nms=dict(iou_threshold=0.85))))
2 changes: 1 addition & 1 deletion configs/grid_rcnn/grid_rcnn_r50_fpn_gn-head_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_base_ = ['../grid_rcnn/grid_rcnn_r50_fpn_gn-head_2x_coco.py']
_base_ = ['grid_rcnn_r50_fpn_gn-head_2x_coco.py']
# learning policy
lr_config = dict(
policy='step',
Expand Down
12 changes: 4 additions & 8 deletions configs/grid_rcnn/grid_rcnn_r50_fpn_gn-head_2x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,9 @@
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=2000,
max_num=2000,
nms_thr=0.7,
max_per_img=2000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
assigner=dict(
Expand All @@ -112,11 +110,9 @@
debug=False)),
test_cfg=dict(
rpn=dict(
nms_across_levels=False,
nms_pre=1000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
max_per_img=1000,
nms=dict(type='nms', iou_threshold=0.7),
min_bbox_size=0),
rcnn=dict(
score_thr=0.03,
Expand Down
5 changes: 3 additions & 2 deletions configs/guided_anchoring/ga_faster_r50_caffe_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@
allowed_border=-1,
center_ratio=0.2,
ignore_ratio=0.5),
rpn_proposal=dict(max_num=300),
rpn_proposal=dict(nms_post=1000, max_per_img=300),
rcnn=dict(
assigner=dict(pos_iou_thr=0.6, neg_iou_thr=0.6, min_pos_iou=0.6),
sampler=dict(type='RandomSampler', num=256))),
test_cfg=dict(rpn=dict(max_num=300), rcnn=dict(score_thr=1e-3)))
test_cfg=dict(
rpn=dict(nms_post=1000, max_per_img=300), rcnn=dict(score_thr=1e-3)))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
5 changes: 3 additions & 2 deletions configs/guided_anchoring/ga_faster_r50_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@
allowed_border=-1,
center_ratio=0.2,
ignore_ratio=0.5),
rpn_proposal=dict(max_num=300),
rpn_proposal=dict(nms_post=1000, max_per_img=300),
rcnn=dict(
assigner=dict(pos_iou_thr=0.6, neg_iou_thr=0.6, min_pos_iou=0.6),
sampler=dict(type='RandomSampler', num=256))),
test_cfg=dict(rpn=dict(max_num=300), rcnn=dict(score_thr=1e-3)))
test_cfg=dict(
rpn=dict(nms_post=1000, max_per_img=300), rcnn=dict(score_thr=1e-3)))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
3 changes: 2 additions & 1 deletion configs/guided_anchoring/ga_rpn_r50_caffe_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
add_gt_as_proposals=False),
allowed_border=-1,
center_ratio=0.2,
ignore_ratio=0.5)))
ignore_ratio=0.5)),
test_cfg=dict(rpn=dict(nms_post=1000)))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
3 changes: 2 additions & 1 deletion configs/guided_anchoring/ga_rpn_r50_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
add_gt_as_proposals=False),
allowed_border=-1,
center_ratio=0.2,
ignore_ratio=0.5)))
ignore_ratio=0.5)),
test_cfg=dict(rpn=dict(nms_post=1000)))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
Loading

0 comments on commit edaf241

Please sign in to comment.