https://github.com/keras-team/keras/issues/8998
generate=vgg16.VGG16(include_top=False,weights='imagenet',input_tensor=y_pre,input_shape=(None,None,3))
Error:ValueError: You are trying to load a weight file containing 13 layers into a model with 18 layers.
Solution:
What you can do in the meantime is to apply the fix yourself to your Keras file. Go to line 176 of keras/applications/vgg16.py in your keras installation directory,
and replace model.load_weights(weights_path) by model.load_weights(weights_path, by_name=True).
本文介绍了如何处理Keras中VGG16模型加载预训练权重时遇到的模型层数不匹配问题,提供了解决方案,即通过修改keras/applications/vgg16.py文件中的特定行来适应不同层数。
2447

被折叠的 条评论
为什么被折叠?



