我将尝试加载一个使用以下代码保存的模型:model.save('myModel.h5')
该模型的定义如下:
self.model = VGGFace(input_tensor=input_tensor, include_top=True)
for layer in self.model.layers:
layer.trainable = False
self.model.get_layer('fc7').trainable = True
last_layer = self.model.get_layer('fc7').output
out = BatchNormalization()(last_layer)
out = Dense(self.n_outputs, activation='softmax', name='fc8')(out)
self.model = Model(input=self.model.input, output=out)
当我尝试使用 model.load_model('myModel.h5')
加载 myModel.h5
文件时,会抛出以下错误:
AttributeError: 'Model' object has no attribute 'load_model'
我猜是因为我没有使用Sequential
模型。
那么我该怎么加载我的模型呢?因为看起来model.save('myModel.h5')
已经可以工作了。
谢谢!!!
model.history
吗? - Eric