Skip to content

Instantly share code, notes, and snippets.

@tanmay1070
Created July 13, 2021 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanmay1070/ffab269998fee5e73918a5a76c25a4f1 to your computer and use it in GitHub Desktop.
Save tanmay1070/ffab269998fee5e73918a5a76c25a4f1 to your computer and use it in GitHub Desktop.
for images, labels in val_data.take(1):
for i in range(6):
print("True_class:",val_data.class_names[labels[i]])
x = image.img_to_array(images[i])
x = np.expand_dims(x, axis=0)
p=np.argmax(model.predict(x))
if p==0:
print("Predicted Image: Electric Bus")
else:
print("Predicted Image: Electric Car")
Output:
True_class: ELectric Bus
Predicted Image: Electric Bus
Predicted class: 0
True_class: ELectric Bus
Predicted Image: Electric Bus
Predicted class: 0
True_class: Electric Car
Predicted Image: Electric Car
Predicted class: 1
True_class: ELectric Bus
Predicted Image: Electric Bus
Predicted class: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment