I had my pre-trained model implemented in Keras which is okay for our application. And since I am trying to optimize its computational performance, I have to convert it into a tf savedmodel model. I have converted the same architecture of it into tf.keras and loaded all variables from the pre-trained h5 file. but when I applied tf.savedmodel.save on this loaded model, it didn’t save the model’s weights into the output asset file (just empty random weights). The pb file I got is only ~2 Mb.
It would be very appreciated if someone knows how to write loaded weights into asset output.
Just to be clear, do you have the Keras model loaded in memory?
if so, you can just use something like model.save() (more details here: Save, serialize, and export models | TensorFlow Core)
it will save in the saved_model format