Open sparshgarg23 opened 2 years ago
将strict的值设为False即可
def _resnet(arch, block, layers, pretrained, progress, **kwargs):
model = ResNet(block, layers, **kwargs)#自己定义的model
if pretrained:
state_dict = load_state_dict_from_url(model_urls[arch], progress=progress)#预训练的model
model.load_state_dict(state_dict, strict=False)
"""如果是加载本地下载好的预训练模型,就用torch.load(),再把strict设为False
model.load_state_dict(torch.load("./resnet50-19c8e357.pth"),strict=False)
"""
return model
这是来自QQ邮箱的假期自动回复邮件。 您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
I am using model_zoo.load_url to load resnet50 model,however when I use the downloaded model,I end up recieivng the error message as shown below
Would it be possible for you to share the resnet50.pth file,if not then any suggestions on what can be done to resolve this.