我正在努力量化我现有的初始模型图,试图将其大小从〜89mb缩小,因此根据google教程here声称大约30mb。 我遇到的问题是当我尝试将以下代码片段复制到mac OS终端时,我收到以下错误。
Code Snippet我尝试复制并运行:
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'
我得到的错误的屏幕截图:
如果您不想打开图像,错误基本上会显示以下内容:
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
关于为什么会发生这种情况以及如何对此进行故障排除的任何想法?
答案 0 :(得分:1)
看起来您没有配置tensorflow repo。您需要在顶级tensorflow目录中./configure
并回答它所要求的所有问题,然后才能在其中构建任何内容(包括transform_graph工具)。
有关详细信息,请参阅"配置安装"在https://www.tensorflow.org/install/install_sources