TensorFlow freeze_graph 找不到 .runfiles
TensorFlow freeze_graph cannot find .runfiles
我已经使用 Bazel 从源代码构建了 TensorFlow,但是,当我尝试 运行 freeze_graph 脚本时,我收到错误请求 .运行files
这是我的 运行 命令
python /home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph --input_graph=graph.pbtx --input_checkpoint=model.ckpt-0.data-00000-of-00001 --input_binary=false --output_graph=../frozen_graph/frozen_graph.pb --output_node_names=ArgMax
这是它生成的错误:
Traceback (most recent call last):
File "/home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph", line 172, in <module>
Main()
File "/home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph", line 111, in Main
module_space = FindModuleSpace()
File "/home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph", line 86, in FindModuleSpace
raise AssertionError('Cannot find .runfiles directory for %s' % sys.argv[0])
AssertionError: Cannot find .runfiles directory for /home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph
知道我做错了什么吗?
如果您使用 bazel 构建 freeze_graph,那么 bazel-bin 包含您的 编译 freeze_graph 代码。这意味着你不需要用 python 调用 freeze_graph,你可以 运行 像这样:
./home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph ...
您可以通过调用运行 python 文件目录:
python /path/to/freeze_graph.py ...
希望对您有所帮助!
在我的例子中,我遇到了同样的错误,我需要构建 freeze_graph 1st:
bazel build tensorflow/python/tools:freeze_graph
之后你可以运行这样:
bazel-bin/tensorflow/python/tools/freeze_graph \
--input_graph=/tmp/inception_v3_inf_graph.pb \
--input_checkpoint=/tmp/checkpoints/inception_v3.ckpt \
--input_binary=true --output_graph=/tmp/frozen_inception_v3.pb \
--output_node_names=InceptionV3/Predictions/Reshape_1
大卫
我已经使用 Bazel 从源代码构建了 TensorFlow,但是,当我尝试 运行 freeze_graph 脚本时,我收到错误请求 .运行files
这是我的 运行 命令
python /home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph --input_graph=graph.pbtx --input_checkpoint=model.ckpt-0.data-00000-of-00001 --input_binary=false --output_graph=../frozen_graph/frozen_graph.pb --output_node_names=ArgMax
这是它生成的错误:
Traceback (most recent call last):
File "/home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph", line 172, in <module>
Main()
File "/home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph", line 111, in Main
module_space = FindModuleSpace()
File "/home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph", line 86, in FindModuleSpace
raise AssertionError('Cannot find .runfiles directory for %s' % sys.argv[0])
AssertionError: Cannot find .runfiles directory for /home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph
知道我做错了什么吗?
如果您使用 bazel 构建 freeze_graph,那么 bazel-bin 包含您的 编译 freeze_graph 代码。这意味着你不需要用 python 调用 freeze_graph,你可以 运行 像这样:
./home/olu/TensorFlow_Source/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph ...
您可以通过调用运行 python 文件目录:
python /path/to/freeze_graph.py ...
希望对您有所帮助!
在我的例子中,我遇到了同样的错误,我需要构建 freeze_graph 1st:
bazel build tensorflow/python/tools:freeze_graph
之后你可以运行这样:
bazel-bin/tensorflow/python/tools/freeze_graph \
--input_graph=/tmp/inception_v3_inf_graph.pb \
--input_checkpoint=/tmp/checkpoints/inception_v3.ckpt \
--input_binary=true --output_graph=/tmp/frozen_inception_v3.pb \
--output_node_names=InceptionV3/Predictions/Reshape_1
大卫