MMdetection之使用mmpretrain实现的骨干网络模型在mmdetection中(重要)

通过mmpretrain使用骨干网

MMDet、MMPreTrain、MMSeg中的模型注册表都继承自MMEngine中的根注册表。这允许这些存储库直接使用彼此已经实现的模块。因此,用户可以在MMDetection中使用MMPretrain中的骨干网,而无需实现MMPretrain中已经存在的网络。

Use backbone network implemented in MMPretrain

假设您希望使用MobileNetV3-small作为RetinaNet的骨干网,配置示例如下:

_base_ = [
    '../_base_/models/retinanet_r50_fpn.py',
    '../_base_/datasets/coco_detection.py',
    '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
# please install mmpretrain
# import mmpretrain.models to trigger register_module in mmpretrain
custom_imports = dict(imports=['mmpretrain.models'], allow_failed_imports=False)
pretrained = 'https://download.openmmlab.com/mmclassification/v0/mobilenet_v3/convert/mobilenet_v3_small-8427ecf0.pth'
model = dict(
    backbone=dict(
        _delete_=True, # Delete the backbone field in _base_
        type='mmpretrain.MobileNetV3', # Using MobileNetV3 from mmpretrain
        arch='small',
        out_indices=(3, 8, 11), # Modify out_indices
        init_cfg=dict(
            type='Pretrained',
            checkpoint=pretrained,
            prefix='backbone.')), # The pre-trained weights of backbone network in mmpretrain have prefix='backbone.'. The prefix in the keys will be removed so that these weights can be normally loaded.
    # Modify in_channels
    neck=dict(in_channels=[24, 48, 96], start_level=0))

利用mmpretrain中的simmim自监督预训练模型在mmdetection中的mask-rcnn模型进行微调训练

在这里插入图片描述

在这里插入图片描述

How to use the mmpretrain model in mmdetection

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值