[英]How to freeze graph in tensorflow 1.5 without using bazel?
in tools directory in tensorflow, we have freeze graph python file, that we can use directly, so why do we need bazel, also I tried using that script, and got the following error : 在tensorflow的tools目录中,我们有冻结图python文件,我们可以直接使用它,为什么我们需要bazel,我也尝试使用该脚本,并收到以下错误:
226 elif input_graph:
--> 227 input_graph_def = _parse_input_graph_proto(input_graph, input_binary)
228 input_meta_graph_def = None
229 if input_meta_graph:
/usr/local/lib/python3.5/dist-packages/tensorflow/python/tools/freeze_graph.py in _parse_input_graph_proto(input_graph, input_binary)
167 with gfile.FastGFile(input_graph, mode) as f:
168 if input_binary:
--> 169 input_graph_def.ParseFromString(f.read())
170 else:
171 text_format.Merge(f.read(), input_graph_def)
DecodeError: Error parsing message
You don't need bazel, you can simply execute python freeze_graph.py
with the appropriate arguments. 您不需要bazel,只需使用适当的参数即可执行python freeze_graph.py
。
About your error, it looks like you're passing a .pbtxt
file without setting --input_binary=False
. 关于您的错误,看来您是在传递.pbtxt
文件而不设置--input_binary=False
。 Sinceit defaults to True
, the script expects you to pass a .pb
file. 由于默认设置为True
,因此脚本希望您传递.pb
文件。 When it tries to decode a .pbtxt
as binary, errors are raised. 当它尝试将.pbtxt
解码为二进制文件时,会引发错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.