Created
May 31, 2017 17:36
-
-
Save jzstark/60639378c513b66ecfa3e0050a77cfca to your computer and use it in GitHub Desktop.
Tensorflow support for import graph:
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
# 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