File "vgg16.py", line 107, in <module>
model = VGG16(include_top=True, classes=10, weights='../vgg16_weights.h5')
File "/usr/local/lib/python3.5/dist-packages/keras/applications/vgg16.py", line 197, in VGG16
model.load_weights(weights)
File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 2645, in load_weights
load_weights_from_hdf5_group(f, self.layers)
File
用VGG预训练权重出错 KeyError: "Can't open attribute (can't locate attribute: 'layer_names')"
最新推荐文章于 2022-07-19 10:02:58 发布
在更新的Keras版本中,使用旧版预训练模型可能会导致'KeyError: Can't open attribute (can't locate attribute: 'layer_names')'。为避免此问题,建议直接从keras.application模块下载匹配当前版本的预训练权重文件。由于预训练代码可能较旧,因此加载时可能会报错。
摘要由CSDN通过智能技术生成