加载 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