Tensorflow

Tensorflow – Graph Freezing

In prediction/inference mode, variable types are unnecessary, so by freezing the graph we convert all variables in a graph and checkpoint into constants. Also there are structure nodes and operations related to training that we don’t need and can be removed by the freezing process as well. The freezing process also saves an easily deployed one file protobuf  instead of 3-4 files (ckpt, graph structure,helpers)…

Code exmaple:

from tensorflow.python.tools import freeze_graph
freeze_graph.freeze_graph('tensorflowModel.pb',
"", True'./tensorflowModel.ckpt',
"output/softmax""save/restore_all", 
"save/Const:0"'frozentensorflowModel.pb', True, "" )