Created
April 10, 2021 16:41
-
-
Save AyishaR/4c91d591d009943bf7997c601c3837a4 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
# pick random test data sample from one batch | |
x = random.randint(0, 32 - 1) # default batch size is 32 | |
for i in test_df.as_numpy_iterator(): | |
img, label = i | |
plt.axis('off') # remove axes | |
plt.imshow(img[x]) # shape from (32, 256, 256, 3) --> (256, 256, 3) | |
output = model.predict(np.expand_dims(img[x],0))[0][0] # getting output; input shape (256, 256, 3) --> (1, 256, 256, 3) | |
pred = (output > 0.5).astype('int') | |
print("Predicted: ", class_names[pred], '(', output, '-->', pred, ')') # Picking the label from class_names base don the model output | |
print("True: ", class_names[label[x][0].astype('int')]) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment