Skip to content

TensorFlow Very Useful tools and commands

LCChen edited this page Nov 26, 2017 · 4 revisions

How to covert a tensor flow model to be shown in the tensor board:

  • python tensorflow/python/tools/import_pb_to_tensorboard.py — model_dir tmp/tensorflow_inception_graph.pb — log_dir tmp/
  • tensorboard — logdir=tmp/

How to quantize and strip the tf model:

bazel-bin/tensorflow/tools/graph_transforms/transform_graph
—-inputs=”input_1" —-in_graph=tmp/tensorflow_inception_graph.pb
—-outputs=”output_node0" —-out_graph=tmp/quantized_graph.pb
—-transforms=’add_default_attributes strip_unused_nodes(type=float, shape=”1,299,299,3") remove_nodes(op=Identity, op=CheckNumerics) fold_constants(ignore_errors=true) fold_batch_norms fold_old_batch_norms quantize_weights strip_unused_nodes sort_by_execution_order’