How to load a keras model saved as .pb

时间秒杀一切 提交于 2021-01-05 13:24:47

问题


I'd like to load a keras model that i've trained and saved it as .pb.
Here's the code,

Am using a jupyter notebook.
The model is successfully saved as saved_model.pb under the same directory. But the code is unable to access it.

Can anybody see to it, how can i access this keras model that's saved in .pb extension.
I checked at several other places for solution but no luck.

Model is saved at model/saved_model.pb.
I've taken out the .pb file and placed it in the same directory where my code file exists.


回答1:


The function tf.keras.models.load_model load a SavedModel into a tf.keras -model. The argument of the function is path to a saved model.

So try model = tf.keras.models.load_model('model')



来源:https://stackoverflow.com/questions/63146892/how-to-load-a-keras-model-saved-as-pb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!