Skip to content

Instantly share code, notes, and snippets.

@gunjannandy
Created December 5, 2020 20:09
# pick random test data sample from one batch
x = random.randint(0, len(Xtest) - 1)
# getting output; input shape (256, 256, 3) --> (1, 256, 256, 3)
output = model.predict(Xtest[x].reshape(1, -1))
pred = np.argmax(output[0]) # finding max
# Picking the label from class_names based on the model output
print("Prdicted: ", class_names[pred])
output_true = np.array(ytest)[x]
print("True: ", class_names[np.argmax(output_true)])
print("Probability: ", output[0][pred])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment