Is there an example on how to generate protobuf files holding trained TensorFlow graphs

前端 未结 6 1866
情话喂你
情话喂你 2020-11-28 19:45

I am looking at Google\'s example on how to deploy and use a pre-trained Tensorflow graph (model) on Android. This example uses a .pb file at:

6条回答
  •  眼角桃花
    2020-11-28 20:02

    I found a freeze_graph() function in the Tensorflow codebase that might be helpful when doing this. From what I understand it swaps variables with constants before serializing the GraphDef and so when you then load this graph from C++ it has no variables that need to be set anymore, and you can directly use it for predictions.

    There is also a test for it and some description in the Guide.

    This seems like the cleanest option here.

提交回复
热议问题