Skip to content

Instantly share code, notes, and snippets.

@jzstark
Created May 31, 2017 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jzstark/60639378c513b66ecfa3e0050a77cfca to your computer and use it in GitHub Desktop.
Save jzstark/60639378c513b66ecfa3e0050a77cfca to your computer and use it in GitHub Desktop.
Tensorflow support for import graph:
# DATA_URL = 'http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz'
def create_graph():
"""Creates a graph from saved GraphDef file and returns a saver."""
# Creates graph from saved graph_def.pb.
with tf.gfile.FastGFile('classify_image_graph_def.pb', 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
_ = tf.import_graph_def(graph_def, name='')
# Observe the layers
sess = tf.Session()
op = sess.graph.get_operations()
# [m.values() for m in op][1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment