将经过训练的 Tensorflow 模型转换为 protobuf

Converting trained Tensorflow model to protobuf

Android Tensorflow Demo stores the model as a protobuf file (tensorflow_inception_graph.pb) 中的初始网络。我想用另一个网络替换这个网络。

是否有关于如何将 Python 中经过训练的 TensorFlow 网络转换为 .pb 的文档或示例?我知道 TensorFlow 的 Saver 但这似乎用于保存中间训练状态。如果模型已经训练,不确定它是如何工作的。

这里有一个例子saving and loading

tf.Graph.as_graph_def() 检索序列化图。然后你就把它写入一个文件。