December 2018
Intermediate to advanced
274 pages
7h 46m
English
Now that we have these files, we need to freeze the graph by converting the variables in the checkpoint file into Const Ops that contain the values of the variables, and combining them with the GraphDef in a standalone file. Using this file makes it easier to load the model inside a mobile app. TensorFlow provides freeze_graph in tensorflow.python.tools for this purpose:
import sys import tensorflow as tf from tensorflow.python.tools import freeze_graph from tensorflow.python.tools import optimize_for_inference_lib MODEL_NAME = 'tfdroid'# Freeze the graphinput_graph_path = MODEL_NAME+'.pbtxt' checkpoint_path = './'+MODEL_NAME+'.ckpt' input_saver_def_path = "" input_binary = False output_node_names = "c" restore_op_name ...
Read now
Unlock full access