1

我正在学习教程VGGNet16,并使用预训练模型收费Keras

vgg16_model = keras.applications.vgg16.VGG16()

model = Sequential()
for layer in vgg16_model.layers:
  model.add(layer)

model.layers.pop()

for layer in model.layers:
  layer.trainable = False

model.add(Dense(10, activation='softmax', name='predict'))
#model.summary()

我曾经model.save('path/model_1.h5')在训练后保存模型model.fit_generator(...)

然后我没时间了Colaboratory。所以我想用model = load_model('path/model_1.h5')再次加载我的模型,而不是再次加载模型vgg16_model = keras.applications.vgg16.VGG16()...

现在我收到了这个错误:

ValueError: Dimension 0 in both shapes must be equal, but are 4096 and
1000. Shapes are [4096,10] and [1000,10]. for 'Assign_61' (op: 'Assign') with input shapes: [4096,10], [1000,10].

我错过了什么?比你!

4

0 回答 0