Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.