daniel451
daniel451

Reputation: 11002

TensorFlow restore/deploy network without the model?

I've built and trained some networks with TensorFlow and successfully managed to save and restore the model's parameters.

However, for some scenarios - e.g. like deploying a trained network in a customer's infrastructure - it is not the best solution to ship the full code/model. Thus, I am wondering if there is any way to restore/run a trained network without the original code/model used for training?

I guess this leads to the question if TensorFlow is able to save a (compressed?) version of the network architecture into the checkpoint files in addition to the weights of the variables.

Is this somehow possible?

Upvotes: 4

Views: 507

Answers (1)

BernardoGO
BernardoGO

Reputation: 1856

If you really need to restore just from the graphdef file (*.pb), to load it from another application for instance, you will need to use the freeze_graph.py script from here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py

This script takes a graphdef (.pb) and a checkpoint (.ckpt) file as input and outputs a graphdef file which contains the weights in the form of constants (you can read the docs on the script for more details).

Upvotes: 2

Related Questions