Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created November 24, 2020 08:37
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 amankharwal/e4c70ec23507a1aa2162d3de9d74d322 to your computer and use it in GitHub Desktop.
Save amankharwal/e4c70ec23507a1aa2162d3de9d74d322 to your computer and use it in GitHub Desktop.
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