我已经以chainer可加载npz文件格式预训练了一个VGG网络,但是在最后一层添加了一个新的FC层,并且我修改了最后一层输出class_number。我已经修改了图层名称,以便将链接器可加载文件用于其他未更改的图层。但我失败了。
Traceback (most recent call last):
File "chainercv/trainer/train.py", line 194, in <module>
main()
File "chainercv/trainer/train.py", line 85, in main
mean_file=args.mean) # 可改为/home/machen/face_expr/result/snapshot_model.npz
File "/home/machen/face_expr/chainercv/links/model/faster_rcnn/faster_rcnn_vgg.py", line 131, in __init__
chainer.serializers.load_npz(pretrained_model, self)
File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0a1-py3.6.egg/chainer/serializers/npz.py", line 140, in load_npz
d.load(obj)
File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0a1-py3.6.egg/chainer/serializer.py", line 82, in load
obj.serialize(self)
File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0a1-py3.6.egg/chainer/link.py", line 794, in serialize
d[name].serialize(serializer[name])
File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0a1-py3.6.egg/chainer/link.py", line 794, in serialize
d[name].serialize(serializer[name])
File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0a1-py3.6.egg/chainer/link.py", line 550, in serialize
data = serializer(name, param.data)
File "/usr/local/anaconda3/lib/python3.6/site-packages/chainer-3.0.0a1-py3.6.egg/chainer/serializers/npz.py", line 106, in __call__
dataset = self.npz[key]
File "/usr/local/anaconda3/lib/python3.6/site-packages/numpy/lib/npyio.py", line 237, in __getitem__
raise KeyError("%s is not a file in the archive" % key)
KeyError: 'head/score_mod/W is not a file in the archive'