简体   繁体   中英

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 :

    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.

About your error, it looks like you're passing a .pbtxt file without setting --input_binary=False . Sinceit defaults to True , the script expects you to pass a .pb file. When it tries to decode a .pbtxt as binary, errors are raised.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM