yxgeee / FD-GAN

[NeurIPS-2018] FD-GAN: Pose-guided Feature Distilling GAN for Robust Person Re-identification.
https://yxgeee.github.io/projects/fdgan.html
281 stars 80 forks source link

KeyError: 'unexpected key "state_dict" in state_dict' #39

Closed haozhihui110 closed 4 years ago

haozhihui110 commented 4 years ago

Hello, the model_best.pth.tar obtained after training in the first stage is used to perform the following error in the second stage: Traceback ( most recent call last): File "train.py", line 119, in main() File "train.py", line 53, in main model = FDGANModel(opt) File "/home/zhihui/Documents/ZHIHUI/FD-GAN/fdgan/model.py", line 28, in init self._init_models() File "/home/zhihui/Documents/ZHIHUI/FD-GAN/fdgan/model.py", line 55, in _init_models self.net_E.load_state_dict(state_dict) File "/home/zhihui/.local/lib/python3.5/site-packages/torchnn/modules/module.py",line 522, in load_state_dict .format(name)) KeyError: 'unexpected key "state_dict" in state_dict'

                                                                                                    Thank you
yxgeee commented 4 years ago

Try to use self.net_E.load_state_dict(state_dict['state_dict'])

haozhihui110 commented 4 years ago

Thanks, i will try later