Open Senwang98 opened 1 year ago
Apologies for the delayed response. At present, we advise utilizing the codes from the main branch as our recommendation.
To use inheriting strategy, you can first copy the model config from the corresponding repo and then add a init_cfg
to the neck
and bbox_head
part.
For example, if the student model is RetinaNet-R50, the student config should be:
student = dict(
type='mmdet.RetinaNet',
backbone=dict(
type='ResNet',
xxx,
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
xxx,
init_cfg=dict(type='Pretrained', prefix='neck.', checkpoint='/your/pretrained/checkpoint/path')),
bbox_head=dict(
type='RetinaHead',
xxx,
init_cfg=dict(type='Pretrained', prefix='bbox_head.', checkpoint='/your/pretrained/checkpoint/path'))
)
And the config in MMRazor should be
_base_ = [
'mmdet::_base_/datasets/coco_detection.py',
'mmdet::_base_/schedules/schedule_2x.py',
'mmdet::_base_/default_runtime.py'
]
teacher_ckpt = 'https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r101_fpn_2x_coco/retinanet_r101_fpn_2x_coco_20200131-5560aee8.pth'
model = dict(
_scope_='mmrazor',
type='FpnTeacherDistill',
architecture=student,
teacher=dict(
cfg_path='mmdet::retinanet/retinanet_r101_fpn_2x_coco.py',
pretrained=False),
teacher_ckpt=teacher_ckpt,
distiller=xxx,
)
If there are any questions, please let us know.
@HIT-cwh Thanks for reply, I'll try it.
Checklist
Describe the question you meet
I want to know where the mmrazor using
inheriting strategy
? Can you tell me how to control the use of the inheriting strategy in mmrazor? (I want manual control to use or not to use)