Zach Rattner
Zach Rattner

Reputation: 21353

Converting trained Tensorflow model to protobuf

The inception net in the Android Tensorflow Demo stores the model as a protobuf file (tensorflow_inception_graph.pb). I'd like to replace this network with another one.

Is there documentation or an example somewhere on how to convert a trained TensorFlow network in Python to .pb? I'm aware of TensorFlow's Saver but this seems to be used to save intermediate training state. Not sure how it works if the model is already trained.

Upvotes: 9

Views: 3663

Answers (2)

Jay Alammar
Jay Alammar

Reputation: 81

tf.Graph.as_graph_def() retrieves the serialized graph. Then you just write it to a file.

Upvotes: 4

Yaroslav Bulatov
Yaroslav Bulatov

Reputation: 57923

Here's an example of saving and loading

Upvotes: 5

Related Questions