Skip to content

Instantly share code, notes, and snippets.

@joelbarmettlerUZH
Last active October 5, 2019 09:14
Show Gist options
  • Save joelbarmettlerUZH/136039479700d9beafd7bdf5ee316f53 to your computer and use it in GitHub Desktop.
Save joelbarmettlerUZH/136039479700d9beafd7bdf5ee316f53 to your computer and use it in GitHub Desktop.
Load tensorflow graph
import tensorflow as tf
def open_graph():
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile('ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb', 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')
return detection_graph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment