My project uses Python to train a MLP on TensorFlow and then I export the graph and the weights in that way:
tf.train.write_graph(sess.graph_def, "./", "inp.txt", True)
saver.save(sess, 'variables/model.ckpt', global_step=1)
Now, although it is fine to use both files to import it back to Python it seems impossible to use it for Android or C++ since it cannot inport the checkpoint .ckpt.
Right now, I'm using the script freeze_graph.py
provided by google to join both files into one by doing:
bazel-bin/tensorflow/python/tools/freeze_graph --input_graph=inp.txt --input_checkpoint=variables/model.ckpt-1 --output_graph=newoutput.pb --output_node_names=output
My question is, is there a way to use another function instead of tf.train.write_graph
to export it with the weights included?
At the moment I'm sorry to tell there is no way.
As discussed previously on Github (have a look), TensorFlow team does not currently address this problem.
Can't say anything for now.
pltrdy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With