Keras:从保存的模型中获取训练数据

时间:2022-03-03 13:55:01

Is it even possible? The model is saved by

它甚至可能吗?该模型由。保存

ModelCheckpoint(model_path, save_best_only=True, monitor='val_acc', mode='max', save_weights_only=False)

Can I do something like this?

我可以这样做吗?

from keras.models import load_model
model = load_model(model_path)
X_train = model.inputs

1 个解决方案

#1


3  

No, this is not possible. ModelCheckpoint with save_weights_only=False only saves the topology, the weights and the optimizer's state (if any) of the model. The training data is not saved along with the model, and model.inputs is just the list of the model's placeholders.

不,这是不可能的。带有save_weights_only = False的ModelCheckpoint仅保存模型的拓扑,权重和优化器的状态(如果有)。训练数据不会与模型一起保存,而model.inputs只是模型占位符的列表。

See also the source code for ModelCheckpoint.

另请参见ModelCheckpoint的源代码。

#1


3  

No, this is not possible. ModelCheckpoint with save_weights_only=False only saves the topology, the weights and the optimizer's state (if any) of the model. The training data is not saved along with the model, and model.inputs is just the list of the model's placeholders.

不,这是不可能的。带有save_weights_only = False的ModelCheckpoint仅保存模型的拓扑,权重和优化器的状态(如果有)。训练数据不会与模型一起保存,而model.inputs只是模型占位符的列表。

See also the source code for ModelCheckpoint.

另请参见ModelCheckpoint的源代码。