Skip to content

Commit

Permalink
[Refactor] move model.pretrained to model.backbone.init_cfg (open-mml…
Browse files Browse the repository at this point in the history
…ab#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
  • Loading branch information
BIGWangYuDong authored Jun 25, 2021
1 parent eb13c97 commit 11f3ca2
Show file tree
Hide file tree
Showing 265 changed files with 1,053 additions and 487 deletions.
4 changes: 2 additions & 2 deletions configs/_base_/models/cascade_mask_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# model settings
model = dict(
type='CascadeRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -10,7 +9,8 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
4 changes: 2 additions & 2 deletions configs/_base_/models/cascade_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# model settings
model = dict(
type='CascadeRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -10,7 +9,8 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
4 changes: 2 additions & 2 deletions configs/_base_/models/fast_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# model settings
model = dict(
type='FastRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -10,7 +9,8 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
6 changes: 4 additions & 2 deletions configs/_base_/models/faster_rcnn_r50_caffe_c4.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
norm_cfg = dict(type='BN', requires_grad=False)
model = dict(
type='FasterRCNN',
pretrained='open-mmlab://detectron2/resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -13,7 +12,10 @@
frozen_stages=1,
norm_cfg=norm_cfg,
norm_eval=True,
style='caffe'),
style='caffe',
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
rpn_head=dict(
type='RPNHead',
in_channels=1024,
Expand Down
6 changes: 4 additions & 2 deletions configs/_base_/models/faster_rcnn_r50_caffe_dc5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
norm_cfg = dict(type='BN', requires_grad=False)
model = dict(
type='FasterRCNN',
pretrained='open-mmlab://detectron2/resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -13,7 +12,10 @@
frozen_stages=1,
norm_cfg=norm_cfg,
norm_eval=True,
style='caffe'),
style='caffe',
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
rpn_head=dict(
type='RPNHead',
in_channels=2048,
Expand Down
4 changes: 2 additions & 2 deletions configs/_base_/models/faster_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# model settings
model = dict(
type='FasterRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -10,7 +9,8 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
6 changes: 4 additions & 2 deletions configs/_base_/models/mask_rcnn_r50_caffe_c4.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
norm_cfg = dict(type='BN', requires_grad=False)
model = dict(
type='MaskRCNN',
pretrained='open-mmlab://detectron2/resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -13,7 +12,10 @@
frozen_stages=1,
norm_cfg=norm_cfg,
norm_eval=True,
style='caffe'),
style='caffe',
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
rpn_head=dict(
type='RPNHead',
in_channels=1024,
Expand Down
4 changes: 2 additions & 2 deletions configs/_base_/models/mask_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# model settings
model = dict(
type='MaskRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -10,7 +9,8 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
4 changes: 2 additions & 2 deletions configs/_base_/models/retinanet_r50_fpn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# model settings
model = dict(
type='RetinaNet',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -10,7 +9,8 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
6 changes: 4 additions & 2 deletions configs/_base_/models/rpn_r50_caffe_c4.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# model settings
model = dict(
type='RPN',
pretrained='open-mmlab://detectron2/resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -12,7 +11,10 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
style='caffe'),
style='caffe',
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
neck=None,
rpn_head=dict(
type='RPNHead',
Expand Down
4 changes: 2 additions & 2 deletions configs/_base_/models/rpn_r50_fpn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# model settings
model = dict(
type='RPN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -10,7 +9,8 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
5 changes: 3 additions & 2 deletions configs/_base_/models/ssd300.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
input_size = 300
model = dict(
type='SingleStageDetector',
pretrained='open-mmlab://vgg16_caffe',
backbone=dict(
type='SSDVGG',
depth=16,
with_last_pool=False,
ceil_mode=True,
out_indices=(3, 4),
out_feature_indices=(22, 34)),
out_feature_indices=(22, 34),
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://vgg16_caffe')),
neck=dict(
type='SSDNeck',
in_channels=(512, 1024),
Expand Down
7 changes: 4 additions & 3 deletions configs/atss/atss_r101_fpn_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
_base_ = './atss_r50_fpn_1x_coco.py'
model = dict(
pretrained='torchvision://resnet101',
backbone=dict(depth=101),
)
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
4 changes: 2 additions & 2 deletions configs/atss/atss_r50_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
]
model = dict(
type='ATSS',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -13,7 +12,8 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'),
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
6 changes: 4 additions & 2 deletions configs/autoassign/autoassign_r50_fpn_8x2_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
]
model = dict(
type='AutoAssign',
pretrained='open-mmlab://detectron2/resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
Expand All @@ -15,7 +14,10 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
style='caffe'),
style='caffe',
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
_base_ = './cascade_mask_rcnn_r50_caffe_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://detectron2/resnet101_caffe',
backbone=dict(depth=101))
backbone=dict(
depth=101,
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet101_caffe')))
6 changes: 5 additions & 1 deletion configs/cascade_rcnn/cascade_mask_rcnn_r101_fpn_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
_base_ = './cascade_mask_rcnn_r50_fpn_1x_coco.py'
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
6 changes: 5 additions & 1 deletion configs/cascade_rcnn/cascade_mask_rcnn_r101_fpn_20e_coco.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
_base_ = './cascade_mask_rcnn_r50_fpn_20e_coco.py'
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
_base_ = ['./cascade_mask_rcnn_r50_fpn_1x_coco.py']

model = dict(
pretrained='open-mmlab://detectron2/resnet50_caffe',
backbone=dict(
norm_cfg=dict(requires_grad=False), norm_eval=True, style='caffe'))

norm_cfg=dict(requires_grad=False), norm_eval=True, style='caffe'),
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet50_caffe'))
img_norm_cfg = dict(
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
train_pipeline = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
_base_ = './cascade_mask_rcnn_r50_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
Expand All @@ -10,4 +9,6 @@
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytorch'))
style='pytorch',
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://resnext101_32x4d')))
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
_base_ = './cascade_mask_rcnn_r50_fpn_20e_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
Expand All @@ -10,4 +9,6 @@
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytorch'))
style='pytorch',
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://resnext101_32x4d')))
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
_base_ = './cascade_mask_rcnn_r50_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
Expand All @@ -10,4 +9,6 @@
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytorch'))
style='pytorch',
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d')))
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
_base_ = './cascade_mask_rcnn_r50_fpn_20e_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
Expand All @@ -10,4 +9,6 @@
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytorch'))
style='pytorch',
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d')))
7 changes: 5 additions & 2 deletions configs/cascade_rcnn/cascade_rcnn_r101_caffe_fpn_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
_base_ = './cascade_rcnn_r50_caffe_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://detectron2/resnet101_caffe',
backbone=dict(depth=101))
backbone=dict(
depth=101,
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet101_caffe')))
6 changes: 5 additions & 1 deletion configs/cascade_rcnn/cascade_rcnn_r101_fpn_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
_base_ = './cascade_rcnn_r50_fpn_1x_coco.py'
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
6 changes: 5 additions & 1 deletion configs/cascade_rcnn/cascade_rcnn_r101_fpn_20e_coco.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
_base_ = './cascade_rcnn_r50_fpn_20e_coco.py'
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
Loading

0 comments on commit 11f3ca2

Please sign in to comment.