【发布时间】:2017-09-10 17:17:28
【问题描述】:
我正在尝试加载保存时使用的模型: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') 似乎有效。
谢谢!!!!
【问题讨论】:
标签: tensorflow deep-learning keras conv-neural-network