Python – Keras: Get training data from saved models

Keras: Get training data from saved models… here is a solution to the problem.

Keras: Get training data from saved models

Is it 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

Solution

No, it’s impossible. ModelCheckpoint with save_weights_only=False Only the topology, weights, and optimizer state of the model ( If any). The training data is not saved with the model, model.inputs is just a list of model placeholders.

See also source code for ModelCheckpoint

Related Problems and Solutions