I have a general question regarding the Tensorflow 2 API when it comes to use saved models.
The guideline on this post explains how to save and load TF models
I am wondering why in the post the saved model gets loaded like this:
model = tf.keras.models.load_model('saved_model_folder')
Is this way of loading the model equal to
model = tf.saved_model.load('saved_model_folder')
I am asking because I read that the Keras H5 format is the old format and it is recommended to use the saved model format.
See here: Save and load Keras models | TensorFlow Core
When I save my model like this
I get the follwoing files
It looks like I get both the Keras H5 and the saved model file
I would perfer to use “new_model = tf.keras.models.load_model(‘saved_model_folder’)” because it gives me a better handling of the model. I can directly call “model.predict()” which is not possible when I load the model via “model = tf.saved_model.load(‘saved_model_folder’)”.