3

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
rvinas
  • 11,824
  • 36
  • 58
vogdb
  • 4,669
  • 3
  • 27
  • 29

1 Answers1

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.

See also the source code for ModelCheckpoint.

rvinas
  • 11,824
  • 36
  • 58
  • Thank you! I shouldn't be afraid of looking into sources myself. Btw the link you have given to ModelCheckpoint does not describe the saved model aspects. It's rather `def save(self, filepath, overwrite=True, include_optimizer=True)` in [keras/engine/network.py](https://github.com/keras-team/keras/blob/a2d11d4724d3cf4a0b18a7fe8448723d92e1c716/keras/engine/saving.py#L26) – vogdb Jul 16 '18 at 16:23