Created
March 15, 2018 02:51
-
-
Save alsrgv/1a83c7953cb04676f6a0b3ec3917a18c to your computer and use it in GitHub Desktop.
Converter of graph.pbtxt to binary graph.pb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import os | |
import sys | |
import tensorflow as tf | |
from google.protobuf import text_format | |
from tensorflow.python.framework import graph_io | |
if len(sys.argv) < 2: | |
print('Usage: %s <filename prefix>' % sys.argv[0]) | |
sys.exit(-1) | |
filename = sys.argv[1] | |
with open(filename + '.pbtxt', 'r') as f: | |
graph_def = tf.GraphDef() | |
file_content = f.read() | |
text_format.Merge(file_content, graph_def) | |
graph_io.write_graph(graph_def, | |
os.path.dirname(filename), | |
os.path.basename(filename) + '.pb', | |
as_text=False) | |
print('Converted %s.pbtxt to %s.pb' % (filename, filename)) |
I tried to apply your code to this pbtxt file here:
https://github.com/google/mediapipe/blob/master/mediapipe/graphs/hand_tracking/multi_hand_tracking_mobile.pbtxt
and received the error:google.protobuf.text_format.ParseError: 6:1 : Message type "tensorflow.GraphDef" has no field named "input_stream".
Can you please see if this is fixable? Thanks.
Any fix yet?
I tried to apply your code to this pbtxt file here:
https://github.com/google/mediapipe/blob/master/mediapipe/graphs/hand_tracking/multi_hand_tracking_mobile.pbtxt
and received the error:google.protobuf.text_format.ParseError: 6:1 : Message type "tensorflow.GraphDef" has no field named "input_stream".
Can you please see if this is fixable? Thanks.
Same error here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried to apply your code to this pbtxt file here:
https://github.com/google/mediapipe/blob/master/mediapipe/graphs/hand_tracking/multi_hand_tracking_mobile.pbtxt
and received the error:
Can you please see if this is fixable? Thanks.