1 Answers

Keras has save and load function in it's api and here is the solution of you question

from keras.models import load_model

model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5'
del model  # deletes the existing model

# returns a compiled model
# identical to the previous one
model = load_model('my_model.h5')

You can also save and load only architecture of the model.

# save as JSON
json_string = model.to_json()

# save as YAML
yaml_string = model.to_yaml()
# model reconstruction from JSON:
from keras.models import model_from_json
model = model_from_json(json_string)

# model reconstruction from YAML:
from keras.models import model_from_yaml
model = model_from_yaml(yaml_string)

Also here is the link you can check out. https://keras.io/getting-started/faq/#how-can-i-save-a-keras-model

Couldn't find what you were looking for?and we will find an expert to answer.
How helpful was this page?