您的位置:首页 > 娱乐 > 八卦 > 杭州设计公司老总被点火_手机壳在线设计网站_b站推广是什么意思_seo自动推广软件

杭州设计公司老总被点火_手机壳在线设计网站_b站推广是什么意思_seo自动推广软件

2024/12/23 8:28:08 来源:https://blog.csdn.net/weixin_52078607/article/details/144218473  浏览:    关键词:杭州设计公司老总被点火_手机壳在线设计网站_b站推广是什么意思_seo自动推广软件
杭州设计公司老总被点火_手机壳在线设计网站_b站推广是什么意思_seo自动推广软件

问题

给当前模型换了个开源的主干网络,并且删除了某些层后,但是发现预训练权重一直加载不上。strict为True时加载报错,strict为False时又什么都加载不上,然后不知道哪里出问题了。

解决

当strict为False时,load_state_dict函数会返回一个字典,该字典含有以下两个键:

missing_keys:在当前模型中存在,但在预训练权重中不存在的键。
unexpected_keys:在当前模型不存在,但在预训练权重中存在的键。
        result=self.backbone.load_state_dict(model_weight,strict=False)print("Missing keys:", result.missing_keys)print("Unexpected keys:", result.unexpected_keys)

得到输出:

Missing keys: ['model.patch_embed.conv1.weight', 'model.patch_embed.conv1.bias', 'model.patch_embed.norm1.1.weight', 'model.patch_embed.norm1.1.bias', 'model.patch_embed.conv2.weight', 'model.patch_embed.conv2.bias', 'model.patch_embed.norm2.1.weight', 'model.patch_embed.norm2.1.bias', 'model.levels.0.blocks.0.norm1.0.weight', 'model.levels.0.blocks.0.norm1.0.bias', 'model.levels.0.blocks.0.dcn.offset_mask.weight', 'model.levels.0.blocks.0.dcn.offset_mask.bias', 'model.levels.0.blocks.0.dcn.value_proj.weight', 'model.levels.0.blocks.0.dcn.value_proj.bias', 'model.levels.0.blocks.0.dcn.output_proj.weight', 'model.levels.0.blocks.0.norm2.0.weight', 'model.levels.0.blocks.0.norm2.0.bias', 'model.levels.0.blocks.0.mlp.fc1.weight', 'model.levels.0.blocks.0.mlp.fc1.bias', 'model.levels.0.blocks.0.mlp.fc2.weight', 'model.levels.0.blocks.1.norm1.0.weight', 'model.levels.0.blocks.1.norm1.0.bias', 'model.levels.0.blocks.1.dcn.offset_mask.weight', 'model.levels.0.blocks.1.dcn.offset_mask.bias', 'model.levels.0.blocks.1.dcn.value_proj.weight', 'model.levels.0.blocks.1.dcn.value_proj.bias', 'model.levels.0.blocks.1.dcn.output_proj.weight', 'model.levels.0.blocks.1.norm2.0.weight', 'model.levels.0.blocks.1.norm2.0.bias', 'model.levels.0.blocks.1.mlp.fc1.weight', 'model.levels.0.blocks.1.mlp.fc1.bias', 'model.levels.0.blocks.1.mlp.fc2.weight', 'model.levels.0.blocks.2.norm1.0.weight', 'model.levels.0.blocks.2.norm1.0.bias', 'model.levels.0.blocks.2.dcn.offset_mask.weight', 'model.levels.0.blocks.2.dcn.offset_mask.bias', 'model.levels.0.blocks.2.dcn.value_proj.weight', 'model.levels.0.blocks.2.dcn.value_proj.bias', 'model.levels.0.blocks.2.dcn.output_proj.weight', 'model.levels.0.blocks.2.norm2.0.weight', 'model.levels.0.blocks.2.norm2.0.bias', 'model.levels.0.blocks.2.mlp.fc1.weight', 'model.levels.0.blocks.2.mlp.fc1.bias', 'model.levels.0.blocks.2.mlp.fc2.weight', 'model.levels.0.blocks.3.norm1.0.weight', 'model.levels.0.blocks.3.norm1.0.bias', 'model.levels.0.blocks.3.dcn.offset_mask.weight', 'model.levels.0.blocks.3.dcn.offset_mask.bias', 'model.levels.0.blocks.3.dcn.value_proj.weight', 'model.levels.0.blocks.3.dcn.value_proj.bias', 'model.levels.0.blocks.3.dcn.output_proj.weight', 'model.levels.0.blocks.3.norm2.0.weight', 'model.levels.0.blocks.3.norm2.0.bias', 'model.levels.0.blocks.3.mlp.fc1.weight', 'model.levels.0.blocks.3.mlp.fc1.bias', 'model.levels.0.blocks.3.mlp.fc2.weight', 'model.levels.0.norm.0.weight', 'model.levels.0.norm.0.bias', 'model.levels.0.downsample.conv.weight', 'model.levels.0.downsample.norm.1.weight', 'model.levels.0.downsample.norm.1.bias', 'model.levels.1.blocks.0.norm1.0.weight', 'model.levels.1.blocks.0.norm1.0.bias', 'model.levels.1.blocks.0.dcn.offset_mask.weight', 'model.levels.1.blocks.0.dcn.offset_mask.bias', 'model.levels.1.blocks.0.dcn.value_proj.weight', 'model.levels.1.blocks.0.dcn.value_proj.bias', 'model.levels.1.blocks.0.dcn.output_proj.weight', 'model.levels.1.blocks.0.norm2.0.weight', 'model.levels.1.blocks.0.norm2.0.bias', 'model.levels.1.blocks.0.mlp.fc1.weight', 'model.levels.1.blocks.0.mlp.fc1.bias', 'model.levels.1.blocks.0.mlp.fc2.weight', 'model.levels.1.blocks.1.norm1.0.weight', 'model.levels.1.blocks.1.norm1.0.bias', 'model.levels.1.blocks.1.dcn.offset_mask.weight', 'model.levels.1.blocks.1.dcn.offset_mask.bias', 'model.levels.1.blocks.1.dcn.value_proj.weight', 'model.levels.1.blocks.1.dcn.value_proj.bias', 'model.levels.1.blocks.1.dcn.output_proj.weight', 'model.levels.1.blocks.1.norm2.0.weight', 'model.levels.1.blocks.1.norm2.0.bias', 'model.levels.1.blocks.1.mlp.fc1.weight', 'model.levels.1.blocks.1.mlp.fc1.bias', 'model.levels.1.blocks.1.mlp.fc2.weight', 'model.levels.1.blocks.2.norm1.0.weight', 'model.levels.1.blocks.2.norm1.0.bias', 'model.levels.1.blocks.2.dcn.offset_mask.weight', 'model.levels.1.blocks.2.dcn.offset_mask.bias', 'model.levels.1.blocks.2.dcn.value_proj.weight', 'model.levels.1.blocks.2.dcn.value_proj.bias', 'model.levels.1.blocks.2.dcn.output_proj.weight', 'model.levels.1.blocks.2.norm2.0.weight', 'model.levels.1.blocks.2.norm2.0.bias', 'model.levels.1.blocks.2.mlp.fc1.weight', 'model.levels.1.blocks.2.mlp.fc1.bias', 'model.levels.1.blocks.2.mlp.fc2.weight', 'model.levels.1.blocks.3.norm1.0.weight', 'model.levels.1.blocks.3.norm1.0.bias', 'model.levels.1.blocks.3.dcn.offset_mask.weight', 'model.levels.1.blocks.3.dcn.offset_mask.bias', 'model.levels.1.blocks.3.dcn.value_proj.weight', 'model.levels.1.blocks.3.dcn.value_proj.bias', 'model.levels.1.blocks.3.dcn.output_proj.weight', 'model.levels.1.blocks.3.norm2.0.weight', 'model.levels.1.blocks.3.norm2.0.bias', 'model.levels.1.blocks.3.mlp.fc1.weight', 'model.levels.1.blocks.3.mlp.fc1.bias', 'model.levels.1.blocks.3.mlp.fc2.weight', 'model.levels.1.norm.0.weight', 'model.levels.1.norm.0.bias', 'model.levels.1.downsample.conv.weight', 'model.levels.1.downsample.norm.1.weight', 'model.levels.1.downsample.norm.1.bias', 'model.levels.2.blocks.0.norm1.0.weight', 'model.levels.2.blocks.0.norm1.0.bias', 'model.levels.2.blocks.0.dcn.offset_mask.weight', 'model.levels.2.blocks.0.dcn.offset_mask.bias', 'model.levels.2.blocks.0.dcn.value_proj.weight', 'model.levels.2.blocks.0.dcn.value_proj.bias', 'model.levels.2.blocks.0.dcn.output_proj.weight', 'model.levels.2.blocks.0.norm2.0.weight', 'model.levels.2.blocks.0.norm2.0.bias', 'model.levels.2.blocks.0.mlp.fc1.weight', 'model.levels.2.blocks.0.mlp.fc1.bias', 'model.levels.2.blocks.0.mlp.fc2.weight', 'model.levels.2.blocks.1.norm1.0.weight', 'model.levels.2.blocks.1.norm1.0.bias', 'model.levels.2.blocks.1.dcn.offset_mask.weight', 'model.levels.2.blocks.1.dcn.offset_mask.bias', 'model.levels.2.blocks.1.dcn.value_proj.weight', 'model.levels.2.blocks.1.dcn.value_proj.bias', 'model.levels.2.blocks.1.dcn.output_proj.weight', 'model.levels.2.blocks.1.norm2.0.weight', 'model.levels.2.blocks.1.norm2.0.bias', 'model.levels.2.blocks.1.mlp.fc1.weight', 'model.levels.2.blocks.1.mlp.fc1.bias', 'model.levels.2.blocks.1.mlp.fc2.weight', 'model.levels.2.blocks.2.norm1.0.weight', 'model.levels.2.blocks.2.norm1.0.bias', 'model.levels.2.blocks.2.dcn.offset_mask.weight', 'model.levels.2.blocks.2.dcn.offset_mask.bias', 'model.levels.2.blocks.2.dcn.value_proj.weight', 'model.levels.2.blocks.2.dcn.value_proj.bias', 'model.levels.2.blocks.2.dcn.output_proj.weight', 'model.levels.2.blocks.2.norm2.0.weight', 'model.levels.2.blocks.2.norm2.0.bias', 'model.levels.2.blocks.2.mlp.fc1.weight', 'model.levels.2.blocks.2.mlp.fc1.bias', 'model.levels.2.blocks.2.mlp.fc2.weight', 'model.levels.2.blocks.3.norm1.0.weight', 'model.levels.2.blocks.3.norm1.0.bias', 'model.levels.2.blocks.3.dcn.offset_mask.weight', 'model.levels.2.blocks.3.dcn.offset_mask.bias', 'model.levels.2.blocks.3.dcn.value_proj.weight', 'model.levels.2.blocks.3.dcn.value_proj.bias', 'model.levels.2.blocks.3.dcn.output_proj.weight', 'model.levels.2.blocks.3.norm2.0.weight', 'model.levels.2.blocks.3.norm2.0.bias', 'model.levels.2.blocks.3.mlp.fc1.weight', 'model.levels.2.blocks.3.mlp.fc1.bias', 'model.levels.2.blocks.3.mlp.fc2.weight', 'model.levels.2.blocks.4.norm1.0.weight', 'model.levels.2.blocks.4.norm1.0.bias', 'model.levels.2.blocks.4.dcn.offset_mask.weight', 'model.levels.2.blocks.4.dcn.offset_mask.bias', 'model.levels.2.blocks.4.dcn.value_proj.weight', 'model.levels.2.blocks.4.dcn.value_proj.bias', 'model.levels.2.blocks.4.dcn.output_proj.weight', 'model.levels.2.blocks.4.norm2.0.weight', 'model.levels.2.blocks.4.norm2.0.bias', 'model.levels.2.blocks.4.mlp.fc1.weight', 'model.levels.2.blocks.4.mlp.fc1.bias', 'model.levels.2.blocks.4.mlp.fc2.weight', 'model.levels.2.blocks.5.norm1.0.weight', 'model.levels.2.blocks.5.norm1.0.bias', 'model.levels.2.blocks.5.dcn.offset_mask.weight', 'model.levels.2.blocks.5.dcn.offset_mask.bias', 'model.levels.2.blocks.5.dcn.value_proj.weight', 'model.levels.2.blocks.5.dcn.value_proj.bias', 'model.levels.2.blocks.5.dcn.output_proj.weight', 'model.levels.2.blocks.5.norm2.0.weight', 'model.levels.2.blocks.5.norm2.0.bias', 'model.levels.2.blocks.5.mlp.fc1.weight', 'model.levels.2.blocks.5.mlp.fc1.bias', 'model.levels.2.blocks.5.mlp.fc2.weight', 'model.levels.2.blocks.6.norm1.0.weight', 'model.levels.2.blocks.6.norm1.0.bias', 'model.levels.2.blocks.6.dcn.offset_mask.weight', 'model.levels.2.blocks.6.dcn.offset_mask.bias', 'model.levels.2.blocks.6.dcn.value_proj.weight', 'model.levels.2.blocks.6.dcn.value_proj.bias', 'model.levels.2.blocks.6.dcn.output_proj.weight', 'model.levels.2.blocks.6.norm2.0.weight', 'model.levels.2.blocks.6.norm2.0.bias', 'model.levels.2.blocks.6.mlp.fc1.weight', 'model.levels.2.blocks.6.mlp.fc1.bias', 'model.levels.2.blocks.6.mlp.fc2.weight', 'model.levels.2.blocks.7.norm1.0.weight', 'model.levels.2.blocks.7.norm1.0.bias', 'model.levels.2.blocks.7.dcn.offset_mask.weight', 'model.levels.2.blocks.7.dcn.offset_mask.bias', 'model.levels.2.blocks.7.dcn.value_proj.weight', 'model.levels.2.blocks.7.dcn.value_proj.bias', 'model.levels.2.blocks.7.dcn.output_proj.weight', 'model.levels.2.blocks.7.norm2.0.weight', 'model.levels.2.blocks.7.norm2.0.bias', 'model.levels.2.blocks.7.mlp.fc1.weight', 'model.levels.2.blocks.7.mlp.fc1.bias', 'model.levels.2.blocks.7.mlp.fc2.weight', 'model.levels.2.blocks.8.norm1.0.weight', 'model.levels.2.blocks.8.norm1.0.bias', 'model.levels.2.blocks.8.dcn.offset_mask.weight', 'model.levels.2.blocks.8.dcn.offset_mask.bias', 'model.levels.2.blocks.8.dcn.value_proj.weight', 'model.levels.2.blocks.8.dcn.value_proj.bias', 'model.levels.2.blocks.8.dcn.output_proj.weight', 'model.levels.2.blocks.8.norm2.0.weight', 'model.levels.2.blocks.8.norm2.0.bias', 'model.levels.2.blocks.8.mlp.fc1.weight', 'model.levels.2.blocks.8.mlp.fc1.bias', 'model.levels.2.blocks.8.mlp.fc2.weight', 'model.levels.2.blocks.9.norm1.0.weight', 'model.levels.2.blocks.9.norm1.0.bias', 'model.levels.2.blocks.9.dcn.offset_mask.weight', 'model.levels.2.blocks.9.dcn.offset_mask.bias', 'model.levels.2.blocks.9.dcn.value_proj.weight', 'model.levels.2.blocks.9.dcn.value_proj.bias', 'model.levels.2.blocks.9.dcn.output_proj.weight', 'model.levels.2.blocks.9.norm2.0.weight', 'model.levels.2.blocks.9.norm2.0.bias', 'model.levels.2.blocks.9.mlp.fc1.weight', 'model.levels.2.blocks.9.mlp.fc1.bias', 'model.levels.2.blocks.9.mlp.fc2.weight', 'model.levels.2.blocks.10.norm1.0.weight', 'model.levels.2.blocks.10.norm1.0.bias', 'model.levels.2.blocks.10.dcn.offset_mask.weight', 'model.levels.2.blocks.10.dcn.offset_mask.bias', 'model.levels.2.blocks.10.dcn.value_proj.weight', 'model.levels.2.blocks.10.dcn.value_proj.bias', 'model.levels.2.blocks.10.dcn.output_proj.weight', 'model.levels.2.blocks.10.norm2.0.weight', 'model.levels.2.blocks.10.norm2.0.bias', 'model.levels.2.blocks.10.mlp.fc1.weight', 'model.levels.2.blocks.10.mlp.fc1.bias', 'model.levels.2.blocks.10.mlp.fc2.weight', 'model.levels.2.blocks.11.norm1.0.weight', 'model.levels.2.blocks.11.norm1.0.bias', 'model.levels.2.blocks.11.dcn.offset_mask.weight', 'model.levels.2.blocks.11.dcn.offset_mask.bias', 'model.levels.2.blocks.11.dcn.value_proj.weight', 'model.levels.2.blocks.11.dcn.value_proj.bias', 'model.levels.2.blocks.11.dcn.output_proj.weight', 'model.levels.2.blocks.11.norm2.0.weight', 'model.levels.2.blocks.11.norm2.0.bias', 'model.levels.2.blocks.11.mlp.fc1.weight', 'model.levels.2.blocks.11.mlp.fc1.bias', 'model.levels.2.blocks.11.mlp.fc2.weight', 'model.levels.2.blocks.12.norm1.0.weight', 'model.levels.2.blocks.12.norm1.0.bias', 'model.levels.2.blocks.12.dcn.offset_mask.weight', 'model.levels.2.blocks.12.dcn.offset_mask.bias', 'model.levels.2.blocks.12.dcn.value_proj.weight', 'model.levels.2.blocks.12.dcn.value_proj.bias', 'model.levels.2.blocks.12.dcn.output_proj.weight', 'model.levels.2.blocks.12.norm2.0.weight', 'model.levels.2.blocks.12.norm2.0.bias', 'model.levels.2.blocks.12.mlp.fc1.weight', 'model.levels.2.blocks.12.mlp.fc1.bias', 'model.levels.2.blocks.12.mlp.fc2.weight', 'model.levels.2.blocks.13.norm1.0.weight', 'model.levels.2.blocks.13.norm1.0.bias', 'model.levels.2.blocks.13.dcn.offset_mask.weight', 'model.levels.2.blocks.13.dcn.offset_mask.bias', 'model.levels.2.blocks.13.dcn.value_proj.weight', 'model.levels.2.blocks.13.dcn.value_proj.bias', 'model.levels.2.blocks.13.dcn.output_proj.weight', 'model.levels.2.blocks.13.norm2.0.weight', 'model.levels.2.blocks.13.norm2.0.bias', 'model.levels.2.blocks.13.mlp.fc1.weight', 'model.levels.2.blocks.13.mlp.fc1.bias', 'model.levels.2.blocks.13.mlp.fc2.weight', 'model.levels.2.blocks.14.norm1.0.weight', 'model.levels.2.blocks.14.norm1.0.bias', 'model.levels.2.blocks.14.dcn.offset_mask.weight', 'model.levels.2.blocks.14.dcn.offset_mask.bias', 'model.levels.2.blocks.14.dcn.value_proj.weight', 'model.levels.2.blocks.14.dcn.value_proj.bias', 'model.levels.2.blocks.14.dcn.output_proj.weight', 'model.levels.2.blocks.14.norm2.0.weight', 'model.levels.2.blocks.14.norm2.0.bias', 'model.levels.2.blocks.14.mlp.fc1.weight', 'model.levels.2.blocks.14.mlp.fc1.bias', 'model.levels.2.blocks.14.mlp.fc2.weight', 'model.levels.2.blocks.15.norm1.0.weight', 'model.levels.2.blocks.15.norm1.0.bias', 'model.levels.2.blocks.15.dcn.offset_mask.weight', 'model.levels.2.blocks.15.dcn.offset_mask.bias', 'model.levels.2.blocks.15.dcn.value_proj.weight', 'model.levels.2.blocks.15.dcn.value_proj.bias', 'model.levels.2.blocks.15.dcn.output_proj.weight', 'model.levels.2.blocks.15.norm2.0.weight', 'model.levels.2.blocks.15.norm2.0.bias', 'model.levels.2.blocks.15.mlp.fc1.weight', 'model.levels.2.blocks.15.mlp.fc1.bias', 'model.levels.2.blocks.15.mlp.fc2.weight', 'model.levels.2.blocks.16.norm1.0.weight', 'model.levels.2.blocks.16.norm1.0.bias', 'model.levels.2.blocks.16.dcn.offset_mask.weight', 'model.levels.2.blocks.16.dcn.offset_mask.bias', 'model.levels.2.blocks.16.dcn.value_proj.weight', 'model.levels.2.blocks.16.dcn.value_proj.bias', 'model.levels.2.blocks.16.dcn.output_proj.weight', 'model.levels.2.blocks.16.norm2.0.weight', 'model.levels.2.blocks.16.norm2.0.bias', 'model.levels.2.blocks.16.mlp.fc1.weight', 'model.levels.2.blocks.16.mlp.fc1.bias', 'model.levels.2.blocks.16.mlp.fc2.weight', 'model.levels.2.blocks.17.norm1.0.weight', 'model.levels.2.blocks.17.norm1.0.bias', 'model.levels.2.blocks.17.dcn.offset_mask.weight', 'model.levels.2.blocks.17.dcn.offset_mask.bias', 'model.levels.2.blocks.17.dcn.value_proj.weight', 'model.levels.2.blocks.17.dcn.value_proj.bias', 'model.levels.2.blocks.17.dcn.output_proj.weight', 'model.levels.2.blocks.17.norm2.0.weight', 'model.levels.2.blocks.17.norm2.0.bias', 'model.levels.2.blocks.17.mlp.fc1.weight', 'model.levels.2.blocks.17.mlp.fc1.bias', 'model.levels.2.blocks.17.mlp.fc2.weight', 'model.levels.2.norm.0.weight', 'model.levels.2.norm.0.bias', 'model.levels.2.downsample.conv.weight', 'model.levels.2.downsample.norm.1.weight', 'model.levels.2.downsample.norm.1.bias', 'model.levels.3.blocks.0.norm1.0.weight', 'model.levels.3.blocks.0.norm1.0.bias', 'model.levels.3.blocks.0.dcn.offset_mask.weight', 'model.levels.3.blocks.0.dcn.offset_mask.bias', 'model.levels.3.blocks.0.dcn.value_proj.weight', 'model.levels.3.blocks.0.dcn.value_proj.bias', 'model.levels.3.blocks.0.dcn.output_proj.weight', 'model.levels.3.blocks.0.norm2.0.weight', 'model.levels.3.blocks.0.norm2.0.bias', 'model.levels.3.blocks.0.mlp.fc1.weight', 'model.levels.3.blocks.0.mlp.fc1.bias', 'model.levels.3.blocks.0.mlp.fc2.weight', 'model.levels.3.blocks.1.norm1.0.weight', 'model.levels.3.blocks.1.norm1.0.bias', 'model.levels.3.blocks.1.dcn.offset_mask.weight', 'model.levels.3.blocks.1.dcn.offset_mask.bias', 'model.levels.3.blocks.1.dcn.value_proj.weight', 'model.levels.3.blocks.1.dcn.value_proj.bias', 'model.levels.3.blocks.1.dcn.output_proj.weight', 'model.levels.3.blocks.1.norm2.0.weight', 'model.levels.3.blocks.1.norm2.0.bias', 'model.levels.3.blocks.1.mlp.fc1.weight', 'model.levels.3.blocks.1.mlp.fc1.bias', 'model.levels.3.blocks.1.mlp.fc2.weight', 'model.levels.3.blocks.2.norm1.0.weight', 'model.levels.3.blocks.2.norm1.0.bias', 'model.levels.3.blocks.2.dcn.offset_mask.weight', 'model.levels.3.blocks.2.dcn.offset_mask.bias', 'model.levels.3.blocks.2.dcn.value_proj.weight', 'model.levels.3.blocks.2.dcn.value_proj.bias', 'model.levels.3.blocks.2.dcn.output_proj.weight', 'model.levels.3.blocks.2.norm2.0.weight', 'model.levels.3.blocks.2.norm2.0.bias', 'model.levels.3.blocks.2.mlp.fc1.weight', 'model.levels.3.blocks.2.mlp.fc1.bias', 'model.levels.3.blocks.2.mlp.fc2.weight', 'model.levels.3.blocks.3.norm1.0.weight', 'model.levels.3.blocks.3.norm1.0.bias', 'model.levels.3.blocks.3.dcn.offset_mask.weight', 'model.levels.3.blocks.3.dcn.offset_mask.bias', 'model.levels.3.blocks.3.dcn.value_proj.weight', 'model.levels.3.blocks.3.dcn.value_proj.bias', 'model.levels.3.blocks.3.dcn.output_proj.weight', 'model.levels.3.blocks.3.norm2.0.weight', 'model.levels.3.blocks.3.norm2.0.bias', 'model.levels.3.blocks.3.mlp.fc1.weight', 'model.levels.3.blocks.3.mlp.fc1.bias', 'model.levels.3.blocks.3.mlp.fc2.weight', 'model.levels.3.norm.0.weight', 'model.levels.3.norm.0.bias', 'model.conv_head.0.weight', 'model.conv_head.1.0.weight', 'model.conv_head.1.0.bias', 'model.conv_head.1.0.running_mean', 'model.conv_head.1.0.running_var']
Unexpected keys: ['patch_embed.conv1.weight', 'patch_embed.conv1.bias', 'patch_embed.norm1.1.weight', 'patch_embed.norm1.1.bias', 'patch_embed.conv2.weight', 'patch_embed.conv2.bias', 'patch_embed.norm2.1.weight', 'patch_embed.norm2.1.bias', 'levels.0.blocks.0.norm1.0.weight', 'levels.0.blocks.0.norm1.0.bias', 'levels.0.blocks.0.dcn.offset_mask.weight', 'levels.0.blocks.0.dcn.offset_mask.bias', 'levels.0.blocks.0.dcn.value_proj.weight', 'levels.0.blocks.0.dcn.value_proj.bias', 'levels.0.blocks.0.dcn.output_proj.weight', 'levels.0.blocks.0.norm2.0.weight', 'levels.0.blocks.0.norm2.0.bias', 'levels.0.blocks.0.mlp.fc1.weight', 'levels.0.blocks.0.mlp.fc1.bias', 'levels.0.blocks.0.mlp.fc2.weight', 'levels.0.blocks.1.norm1.0.weight', 'levels.0.blocks.1.norm1.0.bias', 'levels.0.blocks.1.dcn.offset_mask.weight', 'levels.0.blocks.1.dcn.offset_mask.bias', 'levels.0.blocks.1.dcn.value_proj.weight', 'levels.0.blocks.1.dcn.value_proj.bias', 'levels.0.blocks.1.dcn.output_proj.weight', 'levels.0.blocks.1.norm2.0.weight', 'levels.0.blocks.1.norm2.0.bias', 'levels.0.blocks.1.mlp.fc1.weight', 'levels.0.blocks.1.mlp.fc1.bias', 'levels.0.blocks.1.mlp.fc2.weight', 'levels.0.blocks.2.norm1.0.weight', 'levels.0.blocks.2.norm1.0.bias', 'levels.0.blocks.2.dcn.offset_mask.weight', 'levels.0.blocks.2.dcn.offset_mask.bias', 'levels.0.blocks.2.dcn.value_proj.weight', 'levels.0.blocks.2.dcn.value_proj.bias', 'levels.0.blocks.2.dcn.output_proj.weight', 'levels.0.blocks.2.norm2.0.weight', 'levels.0.blocks.2.norm2.0.bias', 'levels.0.blocks.2.mlp.fc1.weight', 'levels.0.blocks.2.mlp.fc1.bias', 'levels.0.blocks.2.mlp.fc2.weight', 'levels.0.blocks.3.norm1.0.weight', 'levels.0.blocks.3.norm1.0.bias', 'levels.0.blocks.3.dcn.offset_mask.weight', 'levels.0.blocks.3.dcn.offset_mask.bias', 'levels.0.blocks.3.dcn.value_proj.weight', 'levels.0.blocks.3.dcn.value_proj.bias', 'levels.0.blocks.3.dcn.output_proj.weight', 'levels.0.blocks.3.norm2.0.weight', 'levels.0.blocks.3.norm2.0.bias', 'levels.0.blocks.3.mlp.fc1.weight', 'levels.0.blocks.3.mlp.fc1.bias', 'levels.0.blocks.3.mlp.fc2.weight', 'levels.0.norm.0.weight', 'levels.0.norm.0.bias', 'levels.0.downsample.conv.weight', 'levels.0.downsample.norm.1.weight', 'levels.0.downsample.norm.1.bias', 'levels.1.blocks.0.norm1.0.weight', 'levels.1.blocks.0.norm1.0.bias', 'levels.1.blocks.0.dcn.offset_mask.weight', 'levels.1.blocks.0.dcn.offset_mask.bias', 'levels.1.blocks.0.dcn.value_proj.weight', 'levels.1.blocks.0.dcn.value_proj.bias', 'levels.1.blocks.0.dcn.output_proj.weight', 'levels.1.blocks.0.norm2.0.weight', 'levels.1.blocks.0.norm2.0.bias', 'levels.1.blocks.0.mlp.fc1.weight', 'levels.1.blocks.0.mlp.fc1.bias', 'levels.1.blocks.0.mlp.fc2.weight', 'levels.1.blocks.1.norm1.0.weight', 'levels.1.blocks.1.norm1.0.bias', 'levels.1.blocks.1.dcn.offset_mask.weight', 'levels.1.blocks.1.dcn.offset_mask.bias', 'levels.1.blocks.1.dcn.value_proj.weight', 'levels.1.blocks.1.dcn.value_proj.bias', 'levels.1.blocks.1.dcn.output_proj.weight', 'levels.1.blocks.1.norm2.0.weight', 'levels.1.blocks.1.norm2.0.bias', 'levels.1.blocks.1.mlp.fc1.weight', 'levels.1.blocks.1.mlp.fc1.bias', 'levels.1.blocks.1.mlp.fc2.weight', 'levels.1.blocks.2.norm1.0.weight', 'levels.1.blocks.2.norm1.0.bias', 'levels.1.blocks.2.dcn.offset_mask.weight', 'levels.1.blocks.2.dcn.offset_mask.bias', 'levels.1.blocks.2.dcn.value_proj.weight', 'levels.1.blocks.2.dcn.value_proj.bias', 'levels.1.blocks.2.dcn.output_proj.weight', 'levels.1.blocks.2.norm2.0.weight', 'levels.1.blocks.2.norm2.0.bias', 'levels.1.blocks.2.mlp.fc1.weight', 'levels.1.blocks.2.mlp.fc1.bias', 'levels.1.blocks.2.mlp.fc2.weight', 'levels.1.blocks.3.norm1.0.weight', 'levels.1.blocks.3.norm1.0.bias', 'levels.1.blocks.3.dcn.offset_mask.weight', 'levels.1.blocks.3.dcn.offset_mask.bias', 'levels.1.blocks.3.dcn.value_proj.weight', 'levels.1.blocks.3.dcn.value_proj.bias', 'levels.1.blocks.3.dcn.output_proj.weight', 'levels.1.blocks.3.norm2.0.weight', 'levels.1.blocks.3.norm2.0.bias', 'levels.1.blocks.3.mlp.fc1.weight', 'levels.1.blocks.3.mlp.fc1.bias', 'levels.1.blocks.3.mlp.fc2.weight', 'levels.1.norm.0.weight', 'levels.1.norm.0.bias', 'levels.1.downsample.conv.weight', 'levels.1.downsample.norm.1.weight', 'levels.1.downsample.norm.1.bias', 'levels.2.blocks.0.norm1.0.weight', 'levels.2.blocks.0.norm1.0.bias', 'levels.2.blocks.0.dcn.offset_mask.weight', 'levels.2.blocks.0.dcn.offset_mask.bias', 'levels.2.blocks.0.dcn.value_proj.weight', 'levels.2.blocks.0.dcn.value_proj.bias', 'levels.2.blocks.0.dcn.output_proj.weight', 'levels.2.blocks.0.norm2.0.weight', 'levels.2.blocks.0.norm2.0.bias', 'levels.2.blocks.0.mlp.fc1.weight', 'levels.2.blocks.0.mlp.fc1.bias', 'levels.2.blocks.0.mlp.fc2.weight', 'levels.2.blocks.1.norm1.0.weight', 'levels.2.blocks.1.norm1.0.bias', 'levels.2.blocks.1.dcn.offset_mask.weight', 'levels.2.blocks.1.dcn.offset_mask.bias', 'levels.2.blocks.1.dcn.value_proj.weight', 'levels.2.blocks.1.dcn.value_proj.bias', 'levels.2.blocks.1.dcn.output_proj.weight', 'levels.2.blocks.1.norm2.0.weight', 'levels.2.blocks.1.norm2.0.bias', 'levels.2.blocks.1.mlp.fc1.weight', 'levels.2.blocks.1.mlp.fc1.bias', 'levels.2.blocks.1.mlp.fc2.weight', 'levels.2.blocks.2.norm1.0.weight', 'levels.2.blocks.2.norm1.0.bias', 'levels.2.blocks.2.dcn.offset_mask.weight', 'levels.2.blocks.2.dcn.offset_mask.bias', 'levels.2.blocks.2.dcn.value_proj.weight', 'levels.2.blocks.2.dcn.value_proj.bias', 'levels.2.blocks.2.dcn.output_proj.weight', 'levels.2.blocks.2.norm2.0.weight', 'levels.2.blocks.2.norm2.0.bias', 'levels.2.blocks.2.mlp.fc1.weight', 'levels.2.blocks.2.mlp.fc1.bias', 'levels.2.blocks.2.mlp.fc2.weight', 'levels.2.blocks.3.norm1.0.weight', 'levels.2.blocks.3.norm1.0.bias', 'levels.2.blocks.3.dcn.offset_mask.weight', 'levels.2.blocks.3.dcn.offset_mask.bias', 'levels.2.blocks.3.dcn.value_proj.weight', 'levels.2.blocks.3.dcn.value_proj.bias', 'levels.2.blocks.3.dcn.output_proj.weight', 'levels.2.blocks.3.norm2.0.weight', 'levels.2.blocks.3.norm2.0.bias', 'levels.2.blocks.3.mlp.fc1.weight', 'levels.2.blocks.3.mlp.fc1.bias', 'levels.2.blocks.3.mlp.fc2.weight', 'levels.2.blocks.4.norm1.0.weight', 'levels.2.blocks.4.norm1.0.bias', 'levels.2.blocks.4.dcn.offset_mask.weight', 'levels.2.blocks.4.dcn.offset_mask.bias', 'levels.2.blocks.4.dcn.value_proj.weight', 'levels.2.blocks.4.dcn.value_proj.bias', 'levels.2.blocks.4.dcn.output_proj.weight', 'levels.2.blocks.4.norm2.0.weight', 'levels.2.blocks.4.norm2.0.bias', 'levels.2.blocks.4.mlp.fc1.weight', 'levels.2.blocks.4.mlp.fc1.bias', 'levels.2.blocks.4.mlp.fc2.weight', 'levels.2.blocks.5.norm1.0.weight', 'levels.2.blocks.5.norm1.0.bias', 'levels.2.blocks.5.dcn.offset_mask.weight', 'levels.2.blocks.5.dcn.offset_mask.bias', 'levels.2.blocks.5.dcn.value_proj.weight', 'levels.2.blocks.5.dcn.value_proj.bias', 'levels.2.blocks.5.dcn.output_proj.weight', 'levels.2.blocks.5.norm2.0.weight', 'levels.2.blocks.5.norm2.0.bias', 'levels.2.blocks.5.mlp.fc1.weight', 'levels.2.blocks.5.mlp.fc1.bias', 'levels.2.blocks.5.mlp.fc2.weight', 'levels.2.blocks.6.norm1.0.weight', 'levels.2.blocks.6.norm1.0.bias', 'levels.2.blocks.6.dcn.offset_mask.weight', 'levels.2.blocks.6.dcn.offset_mask.bias', 'levels.2.blocks.6.dcn.value_proj.weight', 'levels.2.blocks.6.dcn.value_proj.bias', 'levels.2.blocks.6.dcn.output_proj.weight', 'levels.2.blocks.6.norm2.0.weight', 'levels.2.blocks.6.norm2.0.bias', 'levels.2.blocks.6.mlp.fc1.weight', 'levels.2.blocks.6.mlp.fc1.bias', 'levels.2.blocks.6.mlp.fc2.weight', 'levels.2.blocks.7.norm1.0.weight', 'levels.2.blocks.7.norm1.0.bias', 'levels.2.blocks.7.dcn.offset_mask.weight', 'levels.2.blocks.7.dcn.offset_mask.bias', 'levels.2.blocks.7.dcn.value_proj.weight', 'levels.2.blocks.7.dcn.value_proj.bias', 'levels.2.blocks.7.dcn.output_proj.weight', 'levels.2.blocks.7.norm2.0.weight', 'levels.2.blocks.7.norm2.0.bias', 'levels.2.blocks.7.mlp.fc1.weight', 'levels.2.blocks.7.mlp.fc1.bias', 'levels.2.blocks.7.mlp.fc2.weight', 'levels.2.blocks.8.norm1.0.weight', 'levels.2.blocks.8.norm1.0.bias', 'levels.2.blocks.8.dcn.offset_mask.weight', 'levels.2.blocks.8.dcn.offset_mask.bias', 'levels.2.blocks.8.dcn.value_proj.weight', 'levels.2.blocks.8.dcn.value_proj.bias', 'levels.2.blocks.8.dcn.output_proj.weight', 'levels.2.blocks.8.norm2.0.weight', 'levels.2.blocks.8.norm2.0.bias', 'levels.2.blocks.8.mlp.fc1.weight', 'levels.2.blocks.8.mlp.fc1.bias', 'levels.2.blocks.8.mlp.fc2.weight', 'levels.2.blocks.9.norm1.0.weight', 'levels.2.blocks.9.norm1.0.bias', 'levels.2.blocks.9.dcn.offset_mask.weight', 'levels.2.blocks.9.dcn.offset_mask.bias', 'levels.2.blocks.9.dcn.value_proj.weight', 'levels.2.blocks.9.dcn.value_proj.bias', 'levels.2.blocks.9.dcn.output_proj.weight', 'levels.2.blocks.9.norm2.0.weight', 'levels.2.blocks.9.norm2.0.bias', 'levels.2.blocks.9.mlp.fc1.weight', 'levels.2.blocks.9.mlp.fc1.bias', 'levels.2.blocks.9.mlp.fc2.weight', 'levels.2.blocks.10.norm1.0.weight', 'levels.2.blocks.10.norm1.0.bias', 'levels.2.blocks.10.dcn.offset_mask.weight', 'levels.2.blocks.10.dcn.offset_mask.bias', 'levels.2.blocks.10.dcn.value_proj.weight', 'levels.2.blocks.10.dcn.value_proj.bias', 'levels.2.blocks.10.dcn.output_proj.weight', 'levels.2.blocks.10.norm2.0.weight', 'levels.2.blocks.10.norm2.0.bias', 'levels.2.blocks.10.mlp.fc1.weight', 'levels.2.blocks.10.mlp.fc1.bias', 'levels.2.blocks.10.mlp.fc2.weight', 'levels.2.blocks.11.norm1.0.weight', 'levels.2.blocks.11.norm1.0.bias', 'levels.2.blocks.11.dcn.offset_mask.weight', 'levels.2.blocks.11.dcn.offset_mask.bias', 'levels.2.blocks.11.dcn.value_proj.weight', 'levels.2.blocks.11.dcn.value_proj.bias', 'levels.2.blocks.11.dcn.output_proj.weight', 'levels.2.blocks.11.norm2.0.weight', 'levels.2.blocks.11.norm2.0.bias', 'levels.2.blocks.11.mlp.fc1.weight', 'levels.2.blocks.11.mlp.fc1.bias', 'levels.2.blocks.11.mlp.fc2.weight', 'levels.2.blocks.12.norm1.0.weight', 'levels.2.blocks.12.norm1.0.bias', 'levels.2.blocks.12.dcn.offset_mask.weight', 'levels.2.blocks.12.dcn.offset_mask.bias', 'levels.2.blocks.12.dcn.value_proj.weight', 'levels.2.blocks.12.dcn.value_proj.bias', 'levels.2.blocks.12.dcn.output_proj.weight', 'levels.2.blocks.12.norm2.0.weight', 'levels.2.blocks.12.norm2.0.bias', 'levels.2.blocks.12.mlp.fc1.weight', 'levels.2.blocks.12.mlp.fc1.bias', 'levels.2.blocks.12.mlp.fc2.weight', 'levels.2.blocks.13.norm1.0.weight', 'levels.2.blocks.13.norm1.0.bias', 'levels.2.blocks.13.dcn.offset_mask.weight', 'levels.2.blocks.13.dcn.offset_mask.bias', 'levels.2.blocks.13.dcn.value_proj.weight', 'levels.2.blocks.13.dcn.value_proj.bias', 'levels.2.blocks.13.dcn.output_proj.weight', 'levels.2.blocks.13.norm2.0.weight', 'levels.2.blocks.13.norm2.0.bias', 'levels.2.blocks.13.mlp.fc1.weight', 'levels.2.blocks.13.mlp.fc1.bias', 'levels.2.blocks.13.mlp.fc2.weight', 'levels.2.blocks.14.norm1.0.weight', 'levels.2.blocks.14.norm1.0.bias', 'levels.2.blocks.14.dcn.offset_mask.weight', 'levels.2.blocks.14.dcn.offset_mask.bias', 'levels.2.blocks.14.dcn.value_proj.weight', 'levels.2.blocks.14.dcn.value_proj.bias', 'levels.2.blocks.14.dcn.output_proj.weight', 'levels.2.blocks.14.norm2.0.weight', 'levels.2.blocks.14.norm2.0.bias', 'levels.2.blocks.14.mlp.fc1.weight', 'levels.2.blocks.14.mlp.fc1.bias', 'levels.2.blocks.14.mlp.fc2.weight', 'levels.2.blocks.15.norm1.0.weight', 'levels.2.blocks.15.norm1.0.bias', 'levels.2.blocks.15.dcn.offset_mask.weight', 'levels.2.blocks.15.dcn.offset_mask.bias', 'levels.2.blocks.15.dcn.value_proj.weight', 'levels.2.blocks.15.dcn.value_proj.bias', 'levels.2.blocks.15.dcn.output_proj.weight', 'levels.2.blocks.15.norm2.0.weight', 'levels.2.blocks.15.norm2.0.bias', 'levels.2.blocks.15.mlp.fc1.weight', 'levels.2.blocks.15.mlp.fc1.bias', 'levels.2.blocks.15.mlp.fc2.weight', 'levels.2.blocks.16.norm1.0.weight', 'levels.2.blocks.16.norm1.0.bias', 'levels.2.blocks.16.dcn.offset_mask.weight', 'levels.2.blocks.16.dcn.offset_mask.bias', 'levels.2.blocks.16.dcn.value_proj.weight', 'levels.2.blocks.16.dcn.value_proj.bias', 'levels.2.blocks.16.dcn.output_proj.weight', 'levels.2.blocks.16.norm2.0.weight', 'levels.2.blocks.16.norm2.0.bias', 'levels.2.blocks.16.mlp.fc1.weight', 'levels.2.blocks.16.mlp.fc1.bias', 'levels.2.blocks.16.mlp.fc2.weight', 'levels.2.blocks.17.norm1.0.weight', 'levels.2.blocks.17.norm1.0.bias', 'levels.2.blocks.17.dcn.offset_mask.weight', 'levels.2.blocks.17.dcn.offset_mask.bias', 'levels.2.blocks.17.dcn.value_proj.weight', 'levels.2.blocks.17.dcn.value_proj.bias', 'levels.2.blocks.17.dcn.output_proj.weight', 'levels.2.blocks.17.norm2.0.weight', 'levels.2.blocks.17.norm2.0.bias', 'levels.2.blocks.17.mlp.fc1.weight', 'levels.2.blocks.17.mlp.fc1.bias', 'levels.2.blocks.17.mlp.fc2.weight', 'levels.2.norm.0.weight', 'levels.2.norm.0.bias', 'levels.2.downsample.conv.weight', 'levels.2.downsample.norm.1.weight', 'levels.2.downsample.norm.1.bias', 'levels.3.blocks.0.norm1.0.weight', 'levels.3.blocks.0.norm1.0.bias', 'levels.3.blocks.0.dcn.offset_mask.weight', 'levels.3.blocks.0.dcn.offset_mask.bias', 'levels.3.blocks.0.dcn.value_proj.weight', 'levels.3.blocks.0.dcn.value_proj.bias', 'levels.3.blocks.0.dcn.output_proj.weight', 'levels.3.blocks.0.norm2.0.weight', 'levels.3.blocks.0.norm2.0.bias', 'levels.3.blocks.0.mlp.fc1.weight', 'levels.3.blocks.0.mlp.fc1.bias', 'levels.3.blocks.0.mlp.fc2.weight', 'levels.3.blocks.1.norm1.0.weight', 'levels.3.blocks.1.norm1.0.bias', 'levels.3.blocks.1.dcn.offset_mask.weight', 'levels.3.blocks.1.dcn.offset_mask.bias', 'levels.3.blocks.1.dcn.value_proj.weight', 'levels.3.blocks.1.dcn.value_proj.bias', 'levels.3.blocks.1.dcn.output_proj.weight', 'levels.3.blocks.1.norm2.0.weight', 'levels.3.blocks.1.norm2.0.bias', 'levels.3.blocks.1.mlp.fc1.weight', 'levels.3.blocks.1.mlp.fc1.bias', 'levels.3.blocks.1.mlp.fc2.weight', 'levels.3.blocks.2.norm1.0.weight', 'levels.3.blocks.2.norm1.0.bias', 'levels.3.blocks.2.dcn.offset_mask.weight', 'levels.3.blocks.2.dcn.offset_mask.bias', 'levels.3.blocks.2.dcn.value_proj.weight', 'levels.3.blocks.2.dcn.value_proj.bias', 'levels.3.blocks.2.dcn.output_proj.weight', 'levels.3.blocks.2.norm2.0.weight', 'levels.3.blocks.2.norm2.0.bias', 'levels.3.blocks.2.mlp.fc1.weight', 'levels.3.blocks.2.mlp.fc1.bias', 'levels.3.blocks.2.mlp.fc2.weight', 'levels.3.blocks.3.norm1.0.weight', 'levels.3.blocks.3.norm1.0.bias', 'levels.3.blocks.3.dcn.offset_mask.weight', 'levels.3.blocks.3.dcn.offset_mask.bias', 'levels.3.blocks.3.dcn.value_proj.weight', 'levels.3.blocks.3.dcn.value_proj.bias', 'levels.3.blocks.3.dcn.output_proj.weight', 'levels.3.blocks.3.norm2.0.weight', 'levels.3.blocks.3.norm2.0.bias', 'levels.3.blocks.3.mlp.fc1.weight', 'levels.3.blocks.3.mlp.fc1.bias', 'levels.3.blocks.3.mlp.fc2.weight', 'levels.3.norm.0.weight', 'levels.3.norm.0.bias', 'conv_head.0.weight', 'conv_head.1.0.weight', 'conv_head.1.0.bias', 'conv_head.1.0.running_mean', 'conv_head.1.0.running_var', 'conv_head.1.0.num_batches_tracked', 'head.weight', 'head.bias']

可以看到,我的模型的名字每一层都比预训练的权重多了一个’model.',这就导致了无法加载权重。
于是就把预训练的权重的键名加上‘model.’即可。

        model_weight= {'model.' + key: value for key, value in model_weight.items()}

然后重新调试,可以看到输出:

Missing keys: []
Unexpected keys: ['model.head.weight', 'model.head.bias']

可以看到Missing keys为空,所以需要的权重全部加载了。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com