Created
June 4, 2019 21:12
-
-
Save frogermcs/214dc0342b498649dda671fadb70c041 to your computer and use it in GitHub Desktop.
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 characters
TF_INPUT_TENSOR = 'input:0' | |
TF_OUTPUT_TENSOR = 'MobilenetV2/Predictions/Reshape_1:0' | |
with tf.Session(graph = g) as sess: | |
tf_laptop_out = sess.run(TF_OUTPUT_TENSOR, feed_dict={TF_INPUT_TENSOR: img_laptop_tf}) | |
tf_golden_out = sess.run(TF_OUTPUT_TENSOR, feed_dict={TF_INPUT_TENSOR: img_golden_tf}) | |
tf_laptop_out = tf_laptop_out.flatten() | |
tf_golden_out = tf_golden_out.flatten() | |
laptop_idx = np.argmax(tf_laptop_out) | |
golden_idx = np.argmax(tf_golden_out) | |
print("Prediction for Golden Retriever:", | |
labels[golden_idx], | |
str(tf_golden_out[golden_idx])) | |
print("Prediction for laptop:", | |
labels[laptop_idx], | |
str(tf_laptop_out[laptop_idx])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment