Open-Debin / Emotion-FAN

ICIP 2019: Frame Attention Networks for Facial Expression Recognition in Videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

模型加载问题

flywheel1412 opened this issue · 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".
是因为我使用的网络不对吗?

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

作者您好,我用您提供的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:不考虑给个星星吗?

@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.