Saving and Restoring Models
In the previous section, we learned how we can use data augmentation to generate different variants of an image. This will increase the size of the dataset but will also help the model train on a wider variety of images and help it generalize better.
Once you've trained your model, you will most likely want to deploy it in production and use it to make live predictions. To do so, you will need to save your model as a file. This file can then be loaded by your prediction service so that it can be used as an API or data science tool.
There are different components of a model that can be saved:
- The model's architecture with all the network and layers used
- The model's trained weights
- The training configuration with the loss function, optimizer, and metrics
In TensorFlow, you can save the entire model or each of these components separately. Let's learn how to do this.
Saving the Entire Model
To save all the...