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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 2 deletions
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',

0 commit comments

Comments
 (0)