Skip to content

Commit 11f3ca2

Browse files
[Refactor] move model.pretrained to model.backbone.init_cfg (open-mmlab#5370)
* [Refactor] move model pretrained to backbone init_cfg * fix some bug and add a test unit * add * fix bug * fix priority * fix bug * delete test backbone init cfg * fix potential bug * fix potential bug * add detectors test unit * fix logic * add test unit * fix
1 parent eb13c97 commit 11f3ca2

File tree

265 files changed

+1053
-487
lines changed

Some content is hidden

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

265 files changed

+1053
-487
lines changed

configs/_base_/models/cascade_mask_rcnn_r50_fpn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# model settings
22
model = dict(
33
type='CascadeRCNN',
4-
pretrained='torchvision://resnet50',
54
backbone=dict(
65
type='ResNet',
76
depth=50,
@@ -10,7 +9,8 @@
109
frozen_stages=1,
1110
norm_cfg=dict(type='BN', requires_grad=True),
1211
norm_eval=True,
13-
style='pytorch'),
12+
style='pytorch',
13+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
1414
neck=dict(
1515
type='FPN',
1616
in_channels=[256, 512, 1024, 2048],

configs/_base_/models/cascade_rcnn_r50_fpn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# model settings
22
model = dict(
33
type='CascadeRCNN',
4-
pretrained='torchvision://resnet50',
54
backbone=dict(
65
type='ResNet',
76
depth=50,
@@ -10,7 +9,8 @@
109
frozen_stages=1,
1110
norm_cfg=dict(type='BN', requires_grad=True),
1211
norm_eval=True,
13-
style='pytorch'),
12+
style='pytorch',
13+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
1414
neck=dict(
1515
type='FPN',
1616
in_channels=[256, 512, 1024, 2048],

configs/_base_/models/fast_rcnn_r50_fpn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# model settings
22
model = dict(
33
type='FastRCNN',
4-
pretrained='torchvision://resnet50',
54
backbone=dict(
65
type='ResNet',
76
depth=50,
@@ -10,7 +9,8 @@
109
frozen_stages=1,
1110
norm_cfg=dict(type='BN', requires_grad=True),
1211
norm_eval=True,
13-
style='pytorch'),
12+
style='pytorch',
13+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
1414
neck=dict(
1515
type='FPN',
1616
in_channels=[256, 512, 1024, 2048],

configs/_base_/models/faster_rcnn_r50_caffe_c4.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
norm_cfg = dict(type='BN', requires_grad=False)
33
model = dict(
44
type='FasterRCNN',
5-
pretrained='open-mmlab://detectron2/resnet50_caffe',
65
backbone=dict(
76
type='ResNet',
87
depth=50,
@@ -13,7 +12,10 @@
1312
frozen_stages=1,
1413
norm_cfg=norm_cfg,
1514
norm_eval=True,
16-
style='caffe'),
15+
style='caffe',
16+
init_cfg=dict(
17+
type='Pretrained',
18+
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
1719
rpn_head=dict(
1820
type='RPNHead',
1921
in_channels=1024,

configs/_base_/models/faster_rcnn_r50_caffe_dc5.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
norm_cfg = dict(type='BN', requires_grad=False)
33
model = dict(
44
type='FasterRCNN',
5-
pretrained='open-mmlab://detectron2/resnet50_caffe',
65
backbone=dict(
76
type='ResNet',
87
depth=50,
@@ -13,7 +12,10 @@
1312
frozen_stages=1,
1413
norm_cfg=norm_cfg,
1514
norm_eval=True,
16-
style='caffe'),
15+
style='caffe',
16+
init_cfg=dict(
17+
type='Pretrained',
18+
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
1719
rpn_head=dict(
1820
type='RPNHead',
1921
in_channels=2048,

configs/_base_/models/faster_rcnn_r50_fpn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# model settings
22
model = dict(
33
type='FasterRCNN',
4-
pretrained='torchvision://resnet50',
54
backbone=dict(
65
type='ResNet',
76
depth=50,
@@ -10,7 +9,8 @@
109
frozen_stages=1,
1110
norm_cfg=dict(type='BN', requires_grad=True),
1211
norm_eval=True,
13-
style='pytorch'),
12+
style='pytorch',
13+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
1414
neck=dict(
1515
type='FPN',
1616
in_channels=[256, 512, 1024, 2048],

configs/_base_/models/mask_rcnn_r50_caffe_c4.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
norm_cfg = dict(type='BN', requires_grad=False)
33
model = dict(
44
type='MaskRCNN',
5-
pretrained='open-mmlab://detectron2/resnet50_caffe',
65
backbone=dict(
76
type='ResNet',
87
depth=50,
@@ -13,7 +12,10 @@
1312
frozen_stages=1,
1413
norm_cfg=norm_cfg,
1514
norm_eval=True,
16-
style='caffe'),
15+
style='caffe',
16+
init_cfg=dict(
17+
type='Pretrained',
18+
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
1719
rpn_head=dict(
1820
type='RPNHead',
1921
in_channels=1024,

configs/_base_/models/mask_rcnn_r50_fpn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# model settings
22
model = dict(
33
type='MaskRCNN',
4-
pretrained='torchvision://resnet50',
54
backbone=dict(
65
type='ResNet',
76
depth=50,
@@ -10,7 +9,8 @@
109
frozen_stages=1,
1110
norm_cfg=dict(type='BN', requires_grad=True),
1211
norm_eval=True,
13-
style='pytorch'),
12+
style='pytorch',
13+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
1414
neck=dict(
1515
type='FPN',
1616
in_channels=[256, 512, 1024, 2048],

configs/_base_/models/retinanet_r50_fpn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# model settings
22
model = dict(
33
type='RetinaNet',
4-
pretrained='torchvision://resnet50',
54
backbone=dict(
65
type='ResNet',
76
depth=50,
@@ -10,7 +9,8 @@
109
frozen_stages=1,
1110
norm_cfg=dict(type='BN', requires_grad=True),
1211
norm_eval=True,
13-
style='pytorch'),
12+
style='pytorch',
13+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
1414
neck=dict(
1515
type='FPN',
1616
in_channels=[256, 512, 1024, 2048],

configs/_base_/models/rpn_r50_caffe_c4.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# model settings
22
model = dict(
33
type='RPN',
4-
pretrained='open-mmlab://detectron2/resnet50_caffe',
54
backbone=dict(
65
type='ResNet',
76
depth=50,
@@ -12,7 +11,10 @@
1211
frozen_stages=1,
1312
norm_cfg=dict(type='BN', requires_grad=False),
1413
norm_eval=True,
15-
style='caffe'),
14+
style='caffe',
15+
init_cfg=dict(
16+
type='Pretrained',
17+
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
1618
neck=None,
1719
rpn_head=dict(
1820
type='RPNHead',

configs/_base_/models/rpn_r50_fpn.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# model settings
22
model = dict(
33
type='RPN',
4-
pretrained='torchvision://resnet50',
54
backbone=dict(
65
type='ResNet',
76
depth=50,
@@ -10,7 +9,8 @@
109
frozen_stages=1,
1110
norm_cfg=dict(type='BN', requires_grad=True),
1211
norm_eval=True,
13-
style='pytorch'),
12+
style='pytorch',
13+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
1414
neck=dict(
1515
type='FPN',
1616
in_channels=[256, 512, 1024, 2048],

configs/_base_/models/ssd300.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
input_size = 300
33
model = dict(
44
type='SingleStageDetector',
5-
pretrained='open-mmlab://vgg16_caffe',
65
backbone=dict(
76
type='SSDVGG',
87
depth=16,
98
with_last_pool=False,
109
ceil_mode=True,
1110
out_indices=(3, 4),
12-
out_feature_indices=(22, 34)),
11+
out_feature_indices=(22, 34),
12+
init_cfg=dict(
13+
type='Pretrained', checkpoint='open-mmlab://vgg16_caffe')),
1314
neck=dict(
1415
type='SSDNeck',
1516
in_channels=(512, 1024),

configs/atss/atss_r101_fpn_1x_coco.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
_base_ = './atss_r50_fpn_1x_coco.py'
22
model = dict(
3-
pretrained='torchvision://resnet101',
4-
backbone=dict(depth=101),
5-
)
3+
backbone=dict(
4+
depth=101,
5+
init_cfg=dict(type='Pretrained',
6+
checkpoint='torchvision://resnet101')))

configs/atss/atss_r50_fpn_1x_coco.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
]
55
model = dict(
66
type='ATSS',
7-
pretrained='torchvision://resnet50',
87
backbone=dict(
98
type='ResNet',
109
depth=50,
@@ -13,7 +12,8 @@
1312
frozen_stages=1,
1413
norm_cfg=dict(type='BN', requires_grad=True),
1514
norm_eval=True,
16-
style='pytorch'),
15+
style='pytorch',
16+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
1717
neck=dict(
1818
type='FPN',
1919
in_channels=[256, 512, 1024, 2048],

configs/autoassign/autoassign_r50_fpn_8x2_1x_coco.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
]
77
model = dict(
88
type='AutoAssign',
9-
pretrained='open-mmlab://detectron2/resnet50_caffe',
109
backbone=dict(
1110
type='ResNet',
1211
depth=50,
@@ -15,7 +14,10 @@
1514
frozen_stages=1,
1615
norm_cfg=dict(type='BN', requires_grad=False),
1716
norm_eval=True,
18-
style='caffe'),
17+
style='caffe',
18+
init_cfg=dict(
19+
type='Pretrained',
20+
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
1921
neck=dict(
2022
type='FPN',
2123
in_channels=[256, 512, 1024, 2048],
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
_base_ = './cascade_mask_rcnn_r50_caffe_fpn_1x_coco.py'
22
model = dict(
3-
pretrained='open-mmlab://detectron2/resnet101_caffe',
4-
backbone=dict(depth=101))
3+
backbone=dict(
4+
depth=101,
5+
init_cfg=dict(
6+
type='Pretrained',
7+
checkpoint='open-mmlab://detectron2/resnet101_caffe')))
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
_base_ = './cascade_mask_rcnn_r50_fpn_1x_coco.py'
2-
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
2+
model = dict(
3+
backbone=dict(
4+
depth=101,
5+
init_cfg=dict(type='Pretrained',
6+
checkpoint='torchvision://resnet101')))
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
_base_ = './cascade_mask_rcnn_r50_fpn_20e_coco.py'
2-
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
2+
model = dict(
3+
backbone=dict(
4+
depth=101,
5+
init_cfg=dict(type='Pretrained',
6+
checkpoint='torchvision://resnet101')))

configs/cascade_rcnn/cascade_mask_rcnn_r50_caffe_fpn_1x_coco.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
_base_ = ['./cascade_mask_rcnn_r50_fpn_1x_coco.py']
22

33
model = dict(
4-
pretrained='open-mmlab://detectron2/resnet50_caffe',
54
backbone=dict(
6-
norm_cfg=dict(requires_grad=False), norm_eval=True, style='caffe'))
7-
5+
norm_cfg=dict(requires_grad=False), norm_eval=True, style='caffe'),
6+
init_cfg=dict(
7+
type='Pretrained',
8+
checkpoint='open-mmlab://detectron2/resnet50_caffe'))
89
img_norm_cfg = dict(
910
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
1011
train_pipeline = [
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
_base_ = './cascade_mask_rcnn_r50_fpn_1x_coco.py'
22
model = dict(
3-
pretrained='open-mmlab://resnext101_32x4d',
43
backbone=dict(
54
type='ResNeXt',
65
depth=101,
@@ -10,4 +9,6 @@
109
out_indices=(0, 1, 2, 3),
1110
frozen_stages=1,
1211
norm_cfg=dict(type='BN', requires_grad=True),
13-
style='pytorch'))
12+
style='pytorch',
13+
init_cfg=dict(
14+
type='Pretrained', checkpoint='open-mmlab://resnext101_32x4d')))
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
_base_ = './cascade_mask_rcnn_r50_fpn_20e_coco.py'
22
model = dict(
3-
pretrained='open-mmlab://resnext101_32x4d',
43
backbone=dict(
54
type='ResNeXt',
65
depth=101,
@@ -10,4 +9,6 @@
109
out_indices=(0, 1, 2, 3),
1110
frozen_stages=1,
1211
norm_cfg=dict(type='BN', requires_grad=True),
13-
style='pytorch'))
12+
style='pytorch',
13+
init_cfg=dict(
14+
type='Pretrained', checkpoint='open-mmlab://resnext101_32x4d')))
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
_base_ = './cascade_mask_rcnn_r50_fpn_1x_coco.py'
22
model = dict(
3-
pretrained='open-mmlab://resnext101_64x4d',
43
backbone=dict(
54
type='ResNeXt',
65
depth=101,
@@ -10,4 +9,6 @@
109
out_indices=(0, 1, 2, 3),
1110
frozen_stages=1,
1211
norm_cfg=dict(type='BN', requires_grad=True),
13-
style='pytorch'))
12+
style='pytorch',
13+
init_cfg=dict(
14+
type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d')))
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
_base_ = './cascade_mask_rcnn_r50_fpn_20e_coco.py'
22
model = dict(
3-
pretrained='open-mmlab://resnext101_64x4d',
43
backbone=dict(
54
type='ResNeXt',
65
depth=101,
@@ -10,4 +9,6 @@
109
out_indices=(0, 1, 2, 3),
1110
frozen_stages=1,
1211
norm_cfg=dict(type='BN', requires_grad=True),
13-
style='pytorch'))
12+
style='pytorch',
13+
init_cfg=dict(
14+
type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d')))
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
_base_ = './cascade_rcnn_r50_caffe_fpn_1x_coco.py'
22
model = dict(
3-
pretrained='open-mmlab://detectron2/resnet101_caffe',
4-
backbone=dict(depth=101))
3+
backbone=dict(
4+
depth=101,
5+
init_cfg=dict(
6+
type='Pretrained',
7+
checkpoint='open-mmlab://detectron2/resnet101_caffe')))
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
_base_ = './cascade_rcnn_r50_fpn_1x_coco.py'
2-
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
2+
model = dict(
3+
backbone=dict(
4+
depth=101,
5+
init_cfg=dict(type='Pretrained',
6+
checkpoint='torchvision://resnet101')))
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
_base_ = './cascade_rcnn_r50_fpn_20e_coco.py'
2-
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
2+
model = dict(
3+
backbone=dict(
4+
depth=101,
5+
init_cfg=dict(type='Pretrained',
6+
checkpoint='torchvision://resnet101')))

0 commit comments

Comments
 (0)