Emotion-FAN icon indicating copy to clipboard operation
Emotion-FAN copied to clipboard

模型加载问题

Open flywheel1412 opened this issue 5 years ago • 4 comments

作者您好,我用您提供的Resnet18_FER+_pytorch.pth.tar模型进行测试,出现如下报错RuntimeError: Error(s) in loading state_dict for ResNet_AT: Missing key(s) in state_dict: "alpha.0.bias", "alpha.0.weight", "beta.0.bias", "beta.0.weight", "pred_fc1.bias", "pred_fc1.weight", "pred_fc2.bias", "pred_fc2.weight". Unexpected key(s) in state_dict: "fc.weight", "fc.bias". 是因为我使用的网络不对吗?

flywheel1412 avatar Sep 11 '19 11:09 flywheel1412

Hi. How you download weights? I am unable to get weights.

vikram-ai avatar Sep 11 '19 11:09 vikram-ai

https://pan.baidu.com/s/1OgxPSSzUhaC9mPltIpp2pg#list/path=%2F author put the url of weights in README

flywheel1412 avatar Sep 11 '19 11:09 flywheel1412

作者您好,我用您提供的Resnet18_FER+_pytorch.pth.tar模型进行测试,出现如下报错RuntimeError: Error(s) in loading state_dict for ResNet_AT: Missing key(s) in state_dict: "alpha.0.bias", "alpha.0.weight", "beta.0.bias", "beta.0.weight", "pred_fc1.bias", "pred_fc1.weight", "pred_fc2.bias", "pred_fc2.weight". Unexpected key(s) in state_dict: "fc.weight", "fc.bias". 是因为我使用的网络不对吗?

alpha beta pred_fc1 pred_fc1是我在模型中定义了attention机制,你测试模型如果没有这个结构会报错。我提供的Resnet18_FER+_pytorch.pth.tar也没有这个结构,应该是你用我的模型加载并保存,所以模型中有注意力机制了。 如果你想用注意力机制,那么请用我原来模型加载方式。如果只想用我提供的模型,那么请用替换为这段代码。 你好你可以用如下代码load模型。 import torchvision.models as models _structure = models.resnet18()

PS:不考虑给个星星吗?

Open-Debin avatar Sep 12 '19 03:09 Open-Debin

@vikram-ai @cvTensor Merry Christmas, I recently update the Emotion-FAN, new features include data process, environment install, CK+ code, Baseline code, and more detail instructions. Also, you can find the old version directory of Emotion-FAN in the README.md. I hope my new updates can help you greatly. Please see the Emotion-FAN for more details.

Open-Debin avatar Dec 27 '20 01:12 Open-Debin