Load and Use a Saved Keras Model

Chris Achard
InstructorChris Achard
Share this video with your friends

Social Share Links

Send Tweet
Published 6 years ago
Updated 5 years ago

We will load a saved model from a file, and then use it to make predictions on new data. We won’t need to know anything about the model to do this - we can do it all in a new file by loading a saved model.

Instructor: [00:01] In a new Python file, import load model from keras.models. Then we can call the load model function, passing the file name of the model file that we saved. The result of that will be the entire trained model, so we can assign that to the model variable.

[00:23] We can see the model details by calling model.summary. When we run that, we see all of the layers in the network and their sizes. This allows us to load and even inspect models that we didn't make ourselves. Then we can use this model to make predictions since it's a fully-trained model.

[00:43] First, import NumPy, and then make a few input arrays to make predictions on. Then use the model's predict method to actually make those predictions. When we run that, we see the model's output predictions.

egghead
egghead
~ 2 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today