-
-
Save tachim/6d44136171be86430dba16fecafa5872 to your computer and use it in GitHub Desktop.
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
def create_graph(): | |
with tf.gfile.FastGFile(os.path.join(MODEL_DIR, 'classify_image_graph_def.pb'), 'rb') as f: | |
graph_def = tf.GraphDef() | |
graph_def.ParseFromString(f.read()) | |
_ = tf.import_graph_def(graph_def, name='') | |
def run_inference_on_image(image): | |
if not tf.gfile.Exists(image): | |
tf.logging.fatal('File does not exist %s', image) | |
image_data = tf.gfile.FastGFile(image, 'rb').read() | |
create_graph() | |
# Creates graph from saved GraphDef. | |
with tf.Session(config=tf.ConfigProto( | |
allow_soft_placement=True, | |
log_device_placement=True, | |
)) as sess: | |
print sess.graph.get_collection(tf.GraphKeys.VARIABLES) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment