Run a Tensorflow model without having Tensorflow installed

╄→гoц情女王★ 提交于 2019-12-01 10:56:10

 Is there a way to run this model on another system without installing Tensorflow on it? It is already pre-trained, so I just need to run data through it.

Yes

After you have your model trained . Use tf.python.tools.freeze_graph and tf.python.tools.optimize_for_inference_lib to freeze and optimize the model for inference on other devices like Android.

The output of the above will be

  1. Frozen graph protobuf file (.pb)
  2. Optimized graph protobuf file (.pb)

[These functions will converts all the Variables of the Model to Constant Operations and exports to a protobuf file]

Use the optimized graph protobuf file and load it using Inference methods available in Java and other Tensorflow APIs. Pass the data and get the output.

[ Note for this you didn't installed complete Tensorflow but you only needed the inference library]

A Simple example is demonstrated here :

https://omid.al/posts/2017-02-20-Tutorial-Build-Your-First-Tensorflow-Android-App.html

It is for Android but procedure should be same for Java.

For C++ :click here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!