-
-
Save mdobson/15b4656fdbb1c98b1c0863a24e4dcd04 to your computer and use it in GitHub Desktop.
Revisions
-
mdobson created this gist
Jul 9, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ import tensorflow as tf import sys from tensorflow.python.platform import gfile from tensorflow.core.protobuf import saved_model_pb2 from tensorflow.python.util import compat with tf.Session() as sess: model_filename = 'ssdlite_mobilenet_v2_coco_2018_05_09/saved_model/saved_model.pb' with gfile.FastGFile(model_filename, 'rb') as f: data = compat.as_bytes(f.read()) sm = saved_model_pb2.SavedModel() sm.ParseFromString(data) if 1 != len(sm.meta_graphs): print('More than one graph found.') sys.exit(1) #g_in = tf.import_graph_def(sm.meta_graphs[0].graph_def) [print(n.name) for n in sm.meta_graphs[0].graph_def.node]