Byte-Sized Deep Learning Series: Model Persistence with Keras
- Created By shambhvi
- Posted on May 2nd, 2025
- Overview
- Prerequisites
- Audience
- Curriculum
Description:
Once you've built and trained your model, what's next? You need to persist it so that it can be used later without retraining — whether that’s for evaluation, deployment, or inference on new data.
In this session, we will explore model persistence using Keras and TensorFlow.
You’ll learn how to **save models in the H5 format and TensorFlow’s Saved Model format, and you’ll understand when and why you might choose one format over the other.
We will also dive into TensorFlow model serving to deploy your model for real-time predictions on mobile or edge devices.
Finally, you'll get a chance to put it all together in a hands-on lab, where you will save and load models, ensuring that you can deploy your trained models wherever they are needed.
This session is perfect for anyone looking to move from model creation to deployment, and it will prepare you for the challenges of deploying machine learning models in real-world applications.
Duration: 90 mins
Course Code: BDT499
Learning Objectives:
After this course, you will be able to:
- Introduction to Model Persistence
- Saving models with Keras
- Loading models for inference
- TensorFlow Saved Model Format and Benefits
- Model serving with TensorFlow
Learners who want to take their models beyond the training environment and deploy them on different platforms (mobile, edge, etc.)
Deep learning practitioners and students who are familiar with building and training models with Keras/TensorFlow. Ideal for those looking to understand model persistence (saving and loading models) and learn how to serve models for inference in production environments
Course Outline:
- Introduction to Model Persistence
- What is model persistence? Saving trained models for later use
- Why model persistence is crucial
- Different model formats: H5, TensorFlow Saved Model
- Saving models with Keras
- How to save a model in H5 format with Keras
- Differences between H5 and the TensorFlow Saved Model
- Saving architecture, weight, and training configuration
- Hands-on: Persist model with Keras
- Loading models for inference
- How to load Keras model from disk
- Check if the model is loaded properly and ready for making predictions
- Hands-on: Load model with Keras and check validity
- TensorFlow Saved Model Format and Benefits
- Saved Model Format: TensorFlow’s Default model format
- What does it preserve?
- Benefits: More flexible deployments in TensorFlow serving
- TensorFlow Model Serving
- What is TensorFlow Model Serving?
- TensorFlow lite and TensorFlow.js: mobile and web applications
- Serving models on mobile or edge devices
Training material provided: Yes (Digital format)
Hands-on Lab: Instructions will be provided to install Jupyter notebook and other required python libraries. Students can opt to use ‘Google Colaboratory’ if they do not want to install these tools