Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Nov 24, 2020
Embed
What would you like to do?
categories = np.sort(os.listdir(folder_dir))
fig, ax = plt.subplots(6,6, figsize=(25, 40))
for i in range(6):
for j in range(6):
k = int(np.random.random_sample() * len(X_test))
if(categories[np.argmax(y_test[k])] == categories[np.argmax(model.predict(X_test)[k])]):
ax[i,j].set_title("TRUE: " + categories[np.argmax(y_test[k])], color='green')
ax[i,j].set_xlabel("PREDICTED: " + categories[np.argmax(model.predict(X_test)[k])], color='green')
ax[i,j].imshow(np.array(X_test)[k].reshape(SIZE, SIZE, 3), cmap='gray')
else:
ax[i,j].set_title("TRUE: " + categories[np.argmax(y_test[k])], color='red')
ax[i,j].set_xlabel("PREDICTED: " + categories[np.argmax(model.predict(X_test)[k])], color='red')
ax[i,j].imshow(np.array(X_test)[k].reshape(SIZE, SIZE, 3), cmap='gray')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment