WuJie1010 / Facial-Expression-Recognition.Pytorch

A CNN based pytorch implementation on facial expression recognition (FER2013 and CK+), achieving 73.112% (state-of-the-art) in FER2013 and 94.64% in CK+ dataset
MIT License
1.78k stars 545 forks source link

Not able to load CK+ trained model present in CK+_VGG19 #53

Closed parantap123 closed 4 years ago

parantap123 commented 4 years ago

File "visualize.py", line 43, in net.load_state_dict(checkpoint['net']) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 742, in load_state_dict state_dict = state_dict.copy() File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 535, in getattr type(self).name, name)) AttributeError: 'VGG' object has no attribute 'copy' parantap@parantap-Inspiron-7548:~/codes/MTP/video_classification/codes/x/Facial-Expression-Recognition.Pytorch$ python3 visualize.py Traceback (most recent call last): File "visualize.py", line 43, in net.load_state_dict(checkpoint['net']) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 742, in load_state_dict state_dict = state_dict.copy() File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 535, in getattr type(self).name, name)) AttributeError: 'VGG' object has no attribute 'copy' parantap@parantap-Inspiron-7548:~/codes/MTP/video_classification/codes/x/Facial-Expression-Recognition.Pytorch$ python3 visualize.py Traceback (most recent call last): File "visualize.py", line 43, in net.load_state_dict(checkpoint['net']) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 742, in load_state_dict state_dict = state_dict.copy() File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 535, in getattr type(self).name, name)) AttributeError: 'VGG' object has no attribute 'copy'

LingyiC commented 4 years ago

You can try to change net.load_state_dict(checkpoint['net']) to net.load_state_dict(checkpoint['net'].state_dict()). I hope this helps! :-)

WuJie1010 commented 4 years ago

I did not provide the pre-trained model for CK+

research506 commented 4 years ago

I did not provide the pre-trained model for CK+

Do you have that model to share on a google drive? thanks

WuJie1010 commented 4 years ago

I have not save these models.