Commit e5de97b4 authored by Derek Chow's avatar Derek Chow
Browse files

Do not optimize graph by default.

parent 4ddc9f2d
...@@ -85,13 +85,15 @@ flags.DEFINE_string('trained_checkpoint_prefix', None, ...@@ -85,13 +85,15 @@ flags.DEFINE_string('trained_checkpoint_prefix', None,
'path/to/model.ckpt') 'path/to/model.ckpt')
flags.DEFINE_string('output_directory', None, 'Path to write outputs.') flags.DEFINE_string('output_directory', None, 'Path to write outputs.')
tf.app.flags.MarkFlagAsRequired('pipeline_config_path')
tf.app.flags.MarkFlagAsRequired('trained_checkpoint_prefix')
tf.app.flags.MarkFlagAsRequired('output_directory')
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
def main(_): def main(_):
assert FLAGS.pipeline_config_path, '`pipeline_config_path` is missing'
assert FLAGS.trained_checkpoint_prefix, (
'`trained_checkpoint_prefix` is missing')
assert FLAGS.output_directory, '`output_directory` is missing'
pipeline_config = pipeline_pb2.TrainEvalPipelineConfig() pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
with tf.gfile.GFile(FLAGS.pipeline_config_path, 'r') as f: with tf.gfile.GFile(FLAGS.pipeline_config_path, 'r') as f:
text_format.Merge(f.read(), pipeline_config) text_format.Merge(f.read(), pipeline_config)
......
...@@ -43,7 +43,7 @@ def freeze_graph_with_def_protos( ...@@ -43,7 +43,7 @@ def freeze_graph_with_def_protos(
filename_tensor_name, filename_tensor_name,
clear_devices, clear_devices,
initializer_nodes, initializer_nodes,
optimize_graph=True, optimize_graph=False,
variable_names_blacklist=''): variable_names_blacklist=''):
"""Converts all variables in a graph and checkpoint into constants.""" """Converts all variables in a graph and checkpoint into constants."""
del restore_op_name, filename_tensor_name # Unused by updated loading code. del restore_op_name, filename_tensor_name # Unused by updated loading code.
...@@ -289,7 +289,7 @@ def _export_inference_graph(input_type, ...@@ -289,7 +289,7 @@ def _export_inference_graph(input_type,
use_moving_averages, use_moving_averages,
trained_checkpoint_prefix, trained_checkpoint_prefix,
output_directory, output_directory,
optimize_graph=True, optimize_graph=False,
output_collection_name='inference_op'): output_collection_name='inference_op'):
"""Export helper.""" """Export helper."""
tf.gfile.MakeDirs(output_directory) tf.gfile.MakeDirs(output_directory)
...@@ -340,7 +340,7 @@ def export_inference_graph(input_type, ...@@ -340,7 +340,7 @@ def export_inference_graph(input_type,
pipeline_config, pipeline_config,
trained_checkpoint_prefix, trained_checkpoint_prefix,
output_directory, output_directory,
optimize_graph=True, optimize_graph=False,
output_collection_name='inference_op'): output_collection_name='inference_op'):
"""Exports inference graph for the model specified in the pipeline config. """Exports inference graph for the model specified in the pipeline config.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment