pytorch加载预训练权重失败

问题

给当前模型换了个开源的主干网络,并且删除了某些层后,但是发现预训练权重一直加载不上。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为空,所以需要的权重全部加载了。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/928549.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

STM32--基于STM32的智能家居设计与实现

本文详细介绍基于STM32F103C8T6的智能家居设计与实现,详细设计资料见文末链接 一、功能模块介绍 智能家居系统系统图如下所示,主要包括温湿度传感器、OLED液晶显示,WIFI物联网模块、人体红外预警模块、烟雾传感器模块、蜂鸣器模块 &#…

基于Java Springboot校园导航微信小程序

一、作品包含 源码数据库设计文档万字PPT全套环境和工具资源部署教程 二、项目技术 前端技术:Html、Css、Js、Vue、Element-ui 数据库:MySQL 后端技术:Java、Spring Boot、MyBatis 三、运行环境 开发工具:IDEA/eclipse微信开发…

在 uniapp 项目中使用 Iconify 字体图标库

本文示例在 uniapp 项目中对 Iconify 字体图标库的安装和使用(Iconify 字体图标库是一个免费开源的图标库,它拥有超过20万个开源矢量图标。) 注:本文示例使用的是其 vue3 版本 安装 npm install --save-dev iconify/vue 注&am…

WPF+LibVLC开发播放器-LibVLC播放控制

接上一篇&#xff1a; LibVLC在C#中的使用 实现LibVLC播放器播放控制 界面 界面上添加一个Button按钮用于控制播放 <ButtonGrid.Row"1"Width"88"Height"24"Margin"10,0,0,0"HorizontalAlignment"Left"VerticalAlignme…

ffmpeg安装及配置简单教程

这是ffmpeg官方网站&#xff1a;https://ffmpeg.org/ 这是ffmpeg提供了其他版本的网站&#xff1a;Builds - CODEX FFMPEG gyan.dev 这是ffmpeg提供了提前编译好的可执行文件的github托管网站&#xff1a; https://github.com/BtbN/FFmpeg-Builds/releases 一般windows版本…

Qt-界面优化QSS

QSS介绍 先说下CSS&#xff1a; 在⽹⻚前端开发领域中, CSS 是⼀个⾄关重要的部分. 描述了⼀个⽹⻚的 "样式". 从⽽起到对⽹⻚美化的作⽤。 Qt 仿照 CSS 的模式, 引⼊了 QSS, 来对 Qt 中的控件做出样式上的设定 。 CSS的功能很强大&#xff0c;QSS要逊色一些&#…

后端-一对一的数据封装的两种写法对比

方式一特点&#xff1a;上面的普通封装可以删掉&#xff0c;也可以留着。 注意⚠️&#xff1a;下面的特殊封装的property的值是属性.字段。&#xff08;category.id...) column是sql重命名之后的字段&#xff0c;如果没有重命名是数据库中的值。 方式二特点&#xff1a;上面的…

CTF之密码学(密码特征分析)

一.MD5,sha1,HMAC,NTLM 1.MD5&#xff1a;MD5一般由32/16位的数字(0-9)和字母(a-f)组成的字符串 2.sha1&#xff1a;这种加密的密文特征跟MD5差不多&#xff0c;只不过位数是40&#xff08;sha256&#xff1a;64位&#xff1b;sha512:128位&#xff09; 3.HMAC&#xff1a;这…

网络安全框架及模型-PPDR模型

网络安全框架及模型-PPDR模型 概述: 为了有效应对不断变化的网络安全环境,人们意识到需要一种综合性的方法来管理和保护网络安全。因此,PPDR模型应运而生。它将策略、防护、检测和响应四个要素结合起来,提供了一个全面的框架来处理网络安全问题。 工作原理: PPDR模型的…

QT6学习第八天 QFrame 类

QT6学习第八天 QFrame 类族QLabel 标签部件按钮部件QLineEdit 行编辑器部件QAbstractSpinBoxQAbstractSlider 今天来学一学 QFrame 类。 QFrame 类族 QFrame 类是带有边框的部件的基类。它的子类包括常用的标签部件 QLabel、以及 QLCDNumber、QSplitter、QStackedWidget、QToo…

c++预编译头文件

文章目录 c预编译头文件1.使用g编译预编译头文件2.使用visual studio进行预编译头文件2.1visual studio如何设置输出预处理文件&#xff08;.i文件&#xff09;2.2visual studio 如何设置预编译&#xff08;初始创建空项目的情况下&#xff09;2.3 visual studio打开输出编译时…

简单快速的上手python

前言 python是一门可以快速上手的语言&#xff0c;原因是它语法简单&#xff0c;api容易使用自由灵活 当我们需要安装任何的三方库时&#xff0c;只需要执行 pip install XX 之后在代码里面import xxx就可以使用python啦。 并且python的代码自由灵活&#xff0c;使用缩进区…

【NLP高频面题 - LLM架构篇】旋转位置编码RoPE相对正弦位置编码有哪些优势?

【NLP高频面题 - LLM架构篇】旋转位置编码RoPE相对正弦位置编码有哪些优势&#xff1f; 重要性&#xff1a;⭐⭐⭐ &#x1f4af; NLP Github 项目&#xff1a; NLP 项目实践&#xff1a;fasterai/nlp-project-practice 介绍&#xff1a;该仓库围绕着 NLP 任务模型的设计、训练…

论文:IoU Loss for 2D/3D Object Detection

摘要&#xff1a;在2D/3D目标检测任务中&#xff0c;IoU (Intersection-over- Union)作为一种评价指标&#xff0c;被广泛用于评价不同探测器在测试阶段的性能。然而&#xff0c;在训练阶段&#xff0c;通常采用常见的距离损失(如L1或L2)作为损失函数&#xff0c;以最小化预测值…

STM32 HAL库开发学习1.STM32CubeMX 新建工程

STM32 HAL库开发学习1.STM32CubeMX 新建工程 一、 STM32 CubeMX 下载二、CubeMX 功能介绍1. 固件包路径设置2. 新建工程 三、创建项目实例1. 新建项目2. GPIO 管脚设置3. GPIO 窗口配置4. 调试设置5. 时钟配置6. 项目管理&#xff08;1&#xff09;项目信息&#xff08;2&#…

Qt的定时器应用案例 || Qt的图片添加显示

目录 1.ui界面 2.头文件 3.cpp源文件 4.main文件 5.关于ui_mytimerevent.h的代码编译错误 6.图片的添加展示方式 7.结果展示 8.参考文章 1.ui界面 2.头文件 #ifndef MYTIMEREVENT_H #define MYTIMEREVENT_H#include <QMainWindow> #include <QTime> //#in…

Linux中的常用基本指令(下)

Linux常用基本指令 Linux中的基本指令12.head指令13.tail指令简单解释重定向与管道(重要) 14.date指令(时间相关的指令)15.cal指令(不重要)16.find指令(灰常重要&#xff09;17.grep指令(重要)18.which指令和alias指令19.zip/unzip指令&#xff1a;20.tar指令&#xff08;重要&…

元素「宽高比」完美适配的方案

在日常生活中&#xff0c;我们常常会看到视频或照片能够随着页面尺寸变化&#xff0c;按照自身宽高比进行缩放调整。这种效果是如何实现的呢&#xff1f; 可以通过 CSS 和 JavaScript 两种方式完成&#xff0c;其中 CSS 是比较推荐的方式&#xff0c;因为它能充分利用现代浏览…

Android笔记【12】脚手架Scaffold和导航Navigation

一、前言 学习课程时&#xff0c;对于自己不懂的点的记录。 对于cy老师第二节课总结。 二、内容 1、PPT介绍scaffold 2、开始代码实操 先新建一个screen包&#xff0c;写一个Homescreen函数&#xff0c;包括四个页面。 再新建一个compenent包&#xff0c;写一个displayText…

[极客大挑战 2019]HardSQL--详细解析

信息搜集 登录系统&#xff0c;有两个可能的注入点&#xff1a; 随便输一下看看传参类型&#xff1a; 都是GET型。 SQL注入 传参 usernameadmin’&password123 传参 usernameadmin&password123’ username和password传参&#xff0c;四种闭合方式只有单引号报错&a…