Skip to content

Instantly share code, notes, and snippets.

@tanmay1070
Created Jul 13, 2021
Embed
What would you like to do?
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