Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'unexpected key "head.cls_loc.weight" in state_dict' #1

Open
zhongjunping opened this issue Aug 1, 2018 · 0 comments
Open

Comments

@zhongjunping
Copy link

Hi, thank you for your work. I got the following error when i run train.py. It may be caused by the initial model weight. I used the torchvision_pretrain.path. Can you help me for that? thanks

zhong@zhong-System-Product-Name:~/zhong/Faster-RCNN-LocNet$ python3 train.py train
======user config========
{'caffe_pretrain': False,
'caffe_pretrain_path': 'checkpoints/vgg16_caffe.pth',
'data': 'voc',
'debug_file': '/tmp/debugf',
'env': 'faster-rcnn',
'epoch': 50,
'load_path': '/home/zhong/zhong/Faster-RCNN-LocNet/checkpoints/fasterrcnn_12211511_0.701052458187_torchvision_pretrain.pth',
'lr': 0.0001,
'lr_decay': 0.1,
'max_size': 1000,
'min_size': 600,
'num_workers': 8,
'plot_every': 100,
'port': 8097,
'pretrained_model': 'vgg16',
'prob_thre': 0.5,
'roi_sigma': 1e-05,
'rpn_sigma': 3.0,
'test_num': 10000,
'test_num_workers': 8,
'use_adam': False,
'use_chainer': False,
'use_drop': False,
'voc_data_dir': '/home/zhong/zhong/Faster-RCNN-LocNet/data/VOCdevkit/VOC2007/',
'weight_decay': 0.0005}
==========end============
load data
model construct completed
Traceback (most recent call last):
File "train.py", line 201, in
fire.Fire()
File "/home/zhong/anaconda3/lib/python3.5/site-packages/fire/core.py", line 127, in Fire
component_trace = _Fire(component, args, context, name)
File "/home/zhong/anaconda3/lib/python3.5/site-packages/fire/core.py", line 366, in _Fire
component, remaining_args)
File "/home/zhong/anaconda3/lib/python3.5/site-packages/fire/core.py", line 542, in _CallCallable
result = fn(*varargs, **kwargs)
File "train.py", line 84, in train
trainer.load(opt.load_path)
File "/home/zhong/zhong/Faster-RCNN-LocNet/trainer.py", line 225, in load
self.faster_rcnn.load_state_dict(state_dict['model'])
File "/home/zhong/anaconda3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 522, in load_state_dict
.format(name))
KeyError: 'unexpected key "head.cls_loc.weight" in state_dict'

If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
%config Application.verbose_crash=True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant