Load a saved model

A keras model can be loaded from a hdf5 file. Becareful, a keras generated hdf5 can contain either :

  • the model weights (obtained by the .save_weights() method)
  • the model weights and the model architecture (obtained by the .save() method)

In our case, we will load both the model and its weights with the load_model function from the keras.models module

from keras.models import load_model

model = load_model("my_model.h5")
type(model)
keras.engine.sequential.Sequential