Skip to content

Commit 3f89a03

Browse files
authored
Fix some cfg error (#9866)
1 parent 621b8c8 commit 3f89a03

31 files changed

+283
-546
lines changed
Lines changed: 12 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
_base_ = '../fast_rcnn/fast-rcnn_r50_fpn_1x_coco.py'
1+
_base_ = '../fast_rcnn/fast-rcnn_r50-caffe_fpn_1x_coco.py'
22
model = dict(
3-
backbone=dict(
4-
type='ResNet',
5-
depth=50,
6-
num_stages=4,
7-
out_indices=(0, 1, 2, 3),
8-
frozen_stages=1,
9-
norm_cfg=dict(type='BN', requires_grad=False),
10-
norm_eval=True,
11-
style='caffe',
12-
init_cfg=dict(
13-
type='Pretrained',
14-
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
153
roi_head=dict(
164
bbox_head=dict(
175
bbox_coder=dict(target_stds=[0.04, 0.04, 0.08, 0.08]),
@@ -25,53 +13,15 @@
2513
pos_iou_thr=0.65, neg_iou_thr=0.65, min_pos_iou=0.65),
2614
sampler=dict(num=256))),
2715
test_cfg=dict(rcnn=dict(score_thr=1e-3)))
28-
dataset_type = 'CocoDataset'
29-
data_root = 'data/coco/'
30-
img_norm_cfg = dict(
31-
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
32-
train_pipeline = [
33-
dict(type='LoadImageFromFile'),
34-
dict(type='LoadProposals', num_max_proposals=300),
35-
dict(type='LoadAnnotations', with_bbox=True),
36-
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
37-
dict(type='RandomFlip', flip_ratio=0.5),
38-
dict(type='Normalize', **img_norm_cfg),
39-
dict(type='Pad', size_divisor=32),
40-
dict(type='DefaultFormatBundle'),
41-
dict(type='Collect', keys=['img', 'proposals', 'gt_bboxes', 'gt_labels']),
42-
]
43-
test_pipeline = [
44-
dict(type='LoadImageFromFile'),
45-
dict(type='LoadProposals', num_max_proposals=300),
46-
dict(
47-
type='MultiScaleFlipAug',
48-
img_scale=(1333, 800),
49-
flip=False,
50-
transforms=[
51-
dict(type='Resize', keep_ratio=True),
52-
dict(type='RandomFlip'),
53-
dict(type='Normalize', **img_norm_cfg),
54-
dict(type='Pad', size_divisor=32),
55-
dict(type='ImageToTensor', keys=['img']),
56-
dict(type='ToTensor', keys=['proposals']),
57-
dict(
58-
type='ToDataContainer',
59-
fields=[dict(key='proposals', stack=False)]),
60-
dict(type='Collect', keys=['img', 'proposals']),
61-
])
62-
]
63-
# TODO support proposals input
64-
data = dict(
65-
train=dict(
66-
proposal_file=data_root +
67-
'proposals/crpn_r50_caffe_fpn_1x_train2017.pkl',
68-
pipeline=train_pipeline),
69-
val=dict(
70-
proposal_file=data_root +
71-
'proposals/crpn_r50_caffe_fpn_1x_val2017.pkl',
72-
pipeline=test_pipeline),
73-
test=dict(
74-
proposal_file=data_root +
75-
'proposals/crpn_r50_caffe_fpn_1x_val2017.pkl',
76-
pipeline=test_pipeline))
16+
17+
# MMEngine support the following two ways, users can choose
18+
# according to convenience
19+
# train_dataloader = dict(dataset=dict(proposal_file='proposals/crpn_r50_caffe_fpn_1x_train2017.pkl')) # noqa
20+
_base_.train_dataloader.dataset.proposal_file = 'proposals/crpn_r50_caffe_fpn_1x_train2017.pkl' # noqa
21+
22+
# val_dataloader = dict(dataset=dict(proposal_file='proposals/crpn_r50_caffe_fpn_1x_val2017.pkl')) # noqa
23+
# test_dataloader = val_dataloader
24+
_base_.val_dataloader.dataset.proposal_file = 'proposals/crpn_r50_caffe_fpn_1x_val2017.pkl' # noqa
25+
test_dataloader = _base_.val_dataloader
26+
7727
optim_wrapper = dict(clip_grad=dict(max_norm=35, norm_type=2))

configs/centripetalnet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Keypoint-based detectors have achieved pretty-well performance. However, incorre
2020

2121
Note:
2222

23-
- TTA setting is single-scale and `flip=True`.
23+
- TTA setting is single-scale and `flip=True`. If you want to reproduce the TTA performance, please add `--tta` in the test command.
2424
- The model we released is the best checkpoint rather than the latest checkpoint (box AP 44.8 vs 44.6 in our experiment).
2525

2626
## Citation

configs/centripetalnet/centripetalnet_hourglass104_16xb6-crop511-210e-mstest_coco.py

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
# data settings
4747
train_pipeline = [
48-
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
48+
dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
4949
dict(type='LoadAnnotations', with_bbox=True),
5050
dict(
5151
type='PhotoMetricDistortion',
@@ -70,12 +70,11 @@
7070
dict(type='PackDetInputs'),
7171
]
7272

73-
# TODO: mstest is not currently implemented
7473
test_pipeline = [
7574
dict(
7675
type='LoadImageFromFile',
7776
to_float32=True,
78-
backend_args={{_base_.backend_args}}),
77+
backend_args=_base_.backend_args),
7978
# don't need Resize
8079
dict(
8180
type='RandomCenterCropPad',
@@ -136,3 +135,47 @@
136135
# USER SHOULD NOT CHANGE ITS VALUES.
137136
# base_batch_size = (16 GPUs) x (6 samples per GPU)
138137
auto_scale_lr = dict(base_batch_size=96)
138+
139+
tta_model = dict(
140+
type='DetTTAModel',
141+
tta_cfg=dict(
142+
nms=dict(type='soft_nms', iou_threshold=0.5, method='gaussian'),
143+
max_per_img=100))
144+
145+
tta_pipeline = [
146+
dict(
147+
type='LoadImageFromFile',
148+
to_float32=True,
149+
backend_args=_base_.backend_args),
150+
dict(
151+
type='TestTimeAug',
152+
transforms=[
153+
[
154+
# ``RandomFlip`` must be placed before ``RandomCenterCropPad``,
155+
# otherwise bounding box coordinates after flipping cannot be
156+
# recovered correctly.
157+
dict(type='RandomFlip', prob=1.),
158+
dict(type='RandomFlip', prob=0.)
159+
],
160+
[
161+
dict(
162+
type='RandomCenterCropPad',
163+
crop_size=None,
164+
ratios=None,
165+
border=None,
166+
test_mode=True,
167+
test_pad_mode=['logical_or', 127],
168+
mean=data_preprocessor['mean'],
169+
std=data_preprocessor['std'],
170+
# Image data is not converted to rgb.
171+
to_rgb=data_preprocessor['bgr_to_rgb'])
172+
],
173+
[dict(type='LoadAnnotations', with_bbox=True)],
174+
[
175+
dict(
176+
type='PackDetInputs',
177+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
178+
'flip', 'flip_direction', 'border'))
179+
]
180+
])
181+
]

configs/cornernet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ We propose CornerNet, a new approach to object detection where we detect an obje
2222

2323
Note:
2424

25-
- TTA setting is single-scale and `flip=True`.
25+
- TTA setting is single-scale and `flip=True`. If you want to reproduce the TTA performance, please add `--tta` in the test command.
2626
- Experiments with `images_per_gpu=6` are conducted on Tesla V100-SXM2-32GB, `images_per_gpu=3` are conducted on GeForce GTX 1080 Ti.
2727
- Here are the descriptions of each experiment setting:
2828
- 10 x 5: 10 GPUs with 5 images per gpu. This is the same setting as that reported in the original paper.

configs/cornernet/cornernet_hourglass104_8xb6-210e-mstest_coco.py

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
# data settings
4747
train_pipeline = [
48-
dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}),
48+
dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
4949
dict(type='LoadAnnotations', with_bbox=True),
5050
dict(
5151
type='PhotoMetricDistortion',
@@ -71,12 +71,11 @@
7171
dict(type='PackDetInputs'),
7272
]
7373

74-
# TODO: mstest is not currently implemented
7574
test_pipeline = [
7675
dict(
7776
type='LoadImageFromFile',
7877
to_float32=True,
79-
backend_args={{_base_.backend_args}},
78+
backend_args=_base_.backend_args,
8079
),
8180
# don't need Resize
8281
dict(
@@ -138,3 +137,47 @@
138137
# USER SHOULD NOT CHANGE ITS VALUES.
139138
# base_batch_size = (8 GPUs) x (6 samples per GPU)
140139
auto_scale_lr = dict(base_batch_size=48)
140+
141+
tta_model = dict(
142+
type='DetTTAModel',
143+
tta_cfg=dict(
144+
nms=dict(type='soft_nms', iou_threshold=0.5, method='gaussian'),
145+
max_per_img=100))
146+
147+
tta_pipeline = [
148+
dict(
149+
type='LoadImageFromFile',
150+
to_float32=True,
151+
backend_args=_base_.backend_args),
152+
dict(
153+
type='TestTimeAug',
154+
transforms=[
155+
[
156+
# ``RandomFlip`` must be placed before ``RandomCenterCropPad``,
157+
# otherwise bounding box coordinates after flipping cannot be
158+
# recovered correctly.
159+
dict(type='RandomFlip', prob=1.),
160+
dict(type='RandomFlip', prob=0.)
161+
],
162+
[
163+
dict(
164+
type='RandomCenterCropPad',
165+
crop_size=None,
166+
ratios=None,
167+
border=None,
168+
test_mode=True,
169+
test_pad_mode=['logical_or', 127],
170+
mean=data_preprocessor['mean'],
171+
std=data_preprocessor['std'],
172+
# Image data is not converted to rgb.
173+
to_rgb=data_preprocessor['bgr_to_rgb'])
174+
],
175+
[dict(type='LoadAnnotations', with_bbox=True)],
176+
[
177+
dict(
178+
type='PackDetInputs',
179+
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
180+
'flip', 'flip_direction', 'border'))
181+
]
182+
])
183+
]

configs/dcn/mask-rcnn_r50-dconv-c3-c5_fpn_amp-1x_coco.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
55
stage_with_dcn=(False, True, True, True)))
66

7-
fp16 = dict(loss_scale=512.)
7+
# MMEngine support the following two ways, users can choose
8+
# according to convenience
9+
# optim_wrapper = dict(type='AmpOptimWrapper')
10+
_base_.optim_wrapper.type = 'AmpOptimWrapper'

configs/dcnv2/mask-rcnn_r50-mdconv-c3-c5_fpn_amp-1x_coco.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44
dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
55
stage_with_dcn=(False, True, True, True)))
66

7-
fp16 = dict(loss_scale=512.)
7+
# MMEngine support the following two ways, users can choose
8+
# according to convenience
9+
# optim_wrapper = dict(type='AmpOptimWrapper')
10+
_base_.optim_wrapper.type = 'AmpOptimWrapper'

configs/faster_rcnn/faster-rcnn_r101-caffe_fpn_ms-3x_coco.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,3 @@
99
init_cfg=dict(
1010
type='Pretrained',
1111
checkpoint='open-mmlab://detectron2/resnet101_caffe')))
12-
13-
# use caffe img_norm
14-
img_norm_cfg = dict(
15-
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
16-
train_pipeline = [
17-
dict(type='LoadImageFromFile'),
18-
dict(type='LoadAnnotations', with_bbox=True),
19-
dict(
20-
type='Resize',
21-
img_scale=[(1333, 640), (1333, 800)],
22-
multiscale_mode='range',
23-
keep_ratio=True),
24-
dict(type='RandomFlip', flip_ratio=0.5),
25-
dict(type='Normalize', **img_norm_cfg),
26-
dict(type='Pad', size_divisor=32),
27-
dict(type='DefaultFormatBundle'),
28-
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
29-
]
30-
test_pipeline = [
31-
dict(type='LoadImageFromFile'),
32-
dict(
33-
type='MultiScaleFlipAug',
34-
img_scale=(1333, 800),
35-
flip=False,
36-
transforms=[
37-
dict(type='Resize', keep_ratio=True),
38-
dict(type='RandomFlip'),
39-
dict(type='Normalize', **img_norm_cfg),
40-
dict(type='Pad', size_divisor=32),
41-
dict(type='ImageToTensor', keys=['img']),
42-
dict(type='Collect', keys=['img']),
43-
])
44-
]
45-
46-
data = dict(
47-
train=dict(dataset=dict(pipeline=train_pipeline)),
48-
val=dict(pipeline=test_pipeline),
49-
test=dict(pipeline=test_pipeline))
Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,14 @@
11
_base_ = './faster-rcnn_r50-caffe_c4-1x_coco.py'
2-
# use caffe img_norm
3-
img_norm_cfg = dict(
4-
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
2+
53
train_pipeline = [
6-
dict(type='LoadImageFromFile'),
4+
dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
75
dict(type='LoadAnnotations', with_bbox=True),
86
dict(
9-
type='Resize',
10-
img_scale=[(1333, 640), (1333, 672), (1333, 704), (1333, 736),
11-
(1333, 768), (1333, 800)],
12-
multiscale_mode='value',
7+
type='RandomChoiceResize',
8+
scale=[(1333, 640), (1333, 672), (1333, 704), (1333, 736), (1333, 768),
9+
(1333, 800)],
1310
keep_ratio=True),
14-
dict(type='RandomFlip', flip_ratio=0.5),
15-
dict(type='Normalize', **img_norm_cfg),
16-
dict(type='Pad', size_divisor=32),
17-
dict(type='DefaultFormatBundle'),
18-
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
11+
dict(type='RandomFlip', prob=0.5),
12+
dict(type='PackDetInputs')
1913
]
20-
test_pipeline = [
21-
dict(type='LoadImageFromFile'),
22-
dict(
23-
type='MultiScaleFlipAug',
24-
img_scale=(1333, 800),
25-
flip=False,
26-
transforms=[
27-
dict(type='Resize', keep_ratio=True),
28-
dict(type='RandomFlip'),
29-
dict(type='Normalize', **img_norm_cfg),
30-
dict(type='Pad', size_divisor=32),
31-
dict(type='ImageToTensor', keys=['img']),
32-
dict(type='Collect', keys=['img']),
33-
])
34-
]
35-
data = dict(
36-
train=dict(pipeline=train_pipeline),
37-
val=dict(pipeline=test_pipeline),
38-
test=dict(pipeline=test_pipeline))
14+
_base_.train_dataloader.dataset.pipeline = train_pipeline

configs/faster_rcnn/faster-rcnn_r50-caffe-dc5_1x_coco.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,3 @@
33
'../_base_/datasets/coco_detection.py',
44
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
55
]
6-
# use caffe img_norm
7-
img_norm_cfg = dict(
8-
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
9-
train_pipeline = [
10-
dict(type='LoadImageFromFile'),
11-
dict(type='LoadAnnotations', with_bbox=True),
12-
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
13-
dict(type='RandomFlip', flip_ratio=0.5),
14-
dict(type='Normalize', **img_norm_cfg),
15-
dict(type='Pad', size_divisor=32),
16-
dict(type='DefaultFormatBundle'),
17-
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
18-
]
19-
test_pipeline = [
20-
dict(type='LoadImageFromFile'),
21-
dict(
22-
type='MultiScaleFlipAug',
23-
img_scale=(1333, 800),
24-
flip=False,
25-
transforms=[
26-
dict(type='Resize', keep_ratio=True),
27-
dict(type='RandomFlip'),
28-
dict(type='Normalize', **img_norm_cfg),
29-
dict(type='Pad', size_divisor=32),
30-
dict(type='ImageToTensor', keys=['img']),
31-
dict(type='Collect', keys=['img']),
32-
])
33-
]
34-
data = dict(
35-
train=dict(pipeline=train_pipeline),
36-
val=dict(pipeline=test_pipeline),
37-
test=dict(pipeline=test_pipeline))

0 commit comments

Comments
 (0)