I am trying to convert my model in file (.pb) format to file (.h5) format. I tried following the link below: Tensorflow (.pb) format to Keras (.h5)
Below is the code that I wrote:
import tensorflow as tf
import os
facenet_model = tf.keras.models.load_model('./model_data/20180402-114759/')
tf.keras.models.save_model(facenet_model, 'New_Model.h5') # Saving the Model in H5 Format
loaded_model_from_h5 = tf.keras.models.load_model('New_Model.h5') # Loading the H5 Saved Model
print(loaded_model_from_h5.summary())
In addition to the 20180402-114759.pb file, as shown in the screenshot below:
This is what happened:
Traceback (most recent call last):
File "test_facenet.py", line 25, in <module>
facenet_model = tf.keras.models.load_model('./model_data/20180402-114759/')
File "C:\Users\hai.nguyendinhkhanh\.conda\envs\py36\lib\site-packages\tensorflow_core\python\keras\saving\save.py", line 146, in load_model
loader_impl.parse_saved_model(filepath)
File "C:\Users\hai.nguyendinhkhanh\.conda\envs\py36\lib\site-packages\tensorflow_core\python\saved_model\loader_impl.py", line 83, in parse_saved_model
constants.SAVED_MODEL_FILENAME_PB))
OSError: SavedModel file does not exist at: ./model_data/20180402-114759//{saved_model.pbtxt|saved_model.pb}