问题
I am working to quantize my existing inception model graph in an attempt to reduce its size from ~89mb so something around 30mb as claimed according to the google tutorial here. The issue I am having is when I try to copy the following code snippet into mac OS terminal I get the following error.
Code Snippet I try to copy and run:
bazel build tensorflow/tools/graph_transforms:transform_graph
bazel-bin/tensorflow/tools/graph_transforms/transform_graph \
--in_graph=/tmp/classify_image_graph_def.pb \
--outputs="softmax" --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 quantize_nodes
strip_unused_nodes sort_by_execution_order'
A screenshot of the error I get:
The error essentially says the following in case you don't want to open the image:
ERROR: /Users/vivek/Desktop/commit2/tensorflow-master/tensorflow/core/BUILD:1546:1: no such target '//tensorflow/tools/git:gen/spec.json': target 'gen/spec.json' not declared in package 'tensorflow/tools/git' defined by /Users/vivek/Desktop/commit2/tensorflow-master/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: /Users/vivek/Desktop/commit2/tensorflow-master/tensorflow/core/BUILD:1546:1: no such target '//tensorflow/tools/git:gen/head': target 'gen/head' not declared in package 'tensorflow/tools/git' defined by /Users/vivek/Desktop/commit2/tensorflow-master/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: /Users/vivek/Desktop/commit2/tensorflow-master/tensorflow/core/BUILD:1546:1: no such target '//tensorflow/tools/git:gen/branch_ref': target 'gen/branch_ref' not declared in package 'tensorflow/tools/git' defined by /Users/vivek/Desktop/commit2/tensorflow-master/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: Analysis of target '//tensorflow/tools/graph_transforms:transform_graph' failed; build aborted.
INFO: Elapsed time: 28.452s
Any ideas as to why this is happening and how I can go about troubleshooting this?
回答1:
It looks like you did not configure the tensorflow repo. You need to ./configure
in the top level tensorflow directory and answer all the questions it asks before you can build anything in it (including transform_graph tool).
For more info, see section "Configure the installation" in https://www.tensorflow.org/install/install_sources
来源:https://stackoverflow.com/questions/46065555/tensorflow-quantization-error-analysis-of-target-tensorflow-tools-graph-tra