加載 ckpt格式
checkpoint_file = tf.train.latest_checkpoint(ckpt_modelpath) #load ckpt模型
tf.saver.restore(sess, self.checkpoint_file)
導出pb格式模型 參看 如下鏈接 導出最佳驗證模型
https://tensorflow.google.cn/versions/r1.15/api_docs/python/tf/estimator/BestExporter
導入pb格式模型 定義好sess
checkpoint_file = tf.saved_model.load(sess,["serve"],ckpt_modelpath)
tags 通過 saved_model_cli show --dir ./pbmodel_path --all 查看
MetaGraphDef with tag-set: 'serve' contains
參考https://tensorflow.google.cn/guide/saved_model
https://www.jianshu.com/p/83cfd9571158
tf.saved_model.load 函數
https://tensorflow.google.cn/versions/r1.15/api_docs/python/tf/saved_model/load