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), '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.

  • Set title background color
  • Android Database Transaction
  • How to interface with the BadgeProvider on Samsung phones to add a count to the app icon?
  • Error in gradle build after updating Android Studio with log4j
  • PendingIntent works correctly for the first notification but incorrectly for the rest
  • JSON String returned from SOAP web service containing no records for table
  • Right now, I’m using the script 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?

  • Android Testing: UIAutomator vs Espresso
  • Offline mode for android app using google maps api
  • Random exception android.database.sqlite.SQLiteException: unable to open database file
  • how to use “Select debug app” and “wait for debugger” new feature in jelly bean?
  • Get generated id after insert
  • How to create always-top fullscreen overlay activity in Android
  • 3 Solutions collect form web for “Add weights to .pb file exported by TensorFlow”

    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.


    Currently there is no way to do that, unfortunately.

    It would be really good to have a way to do that directly. I mean, it would be great to have something to do it a single shot way instead of having to generate two files and then run another script to convert those.

    It is specially bad for those who use hybrid graphics on a laptop.

    Anyways, as TensorFlow group said:

    We do not have plans to support outputting .pb files directly. If you
    are worried about too many checkpoint files taking up space, you can
    limit the max_to_keep to 1.

    Currently, freezegraph is the only way to address this issue.

    For me it doesn’t work quite well because I have to install it on many computers daily since people keep messsing things up and freezegraph forces me to install it from source.

    They have to create another way to do it. A built-in way. Specially if they want us to use to for android.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.