Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add weights to .pb file exported by TensorFlow

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?

like image 814
BernardoGO Avatar asked Nov 03 '16 18:11

BernardoGO


1 Answers

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

like image 133
pltrdy Avatar answered Oct 05 '22 04:10

pltrdy