Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created February 26, 2020 07:12
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 lakshay-arora/b8149570aaed51868bbd606369903599 to your computer and use it in GitHub Desktop.
Save lakshay-arora/b8149570aaed51868bbd606369903599 to your computer and use it in GitHub Desktop.
# import skimage and matplotlib and random
from skimage import io
import matplotlib.pyplot as plt
%matplotlib inline
import random
# function to display image
def show(idx, title):
plt.figure()
plt.imshow(test_images[idx].reshape(28,28))
plt.axis('off')
plt.title('\n\n{}'.format(test_labels[idx]), fontdict={'size': 16})
# generate a random index
r = random.randint(0,len(test_images)-1)
#
print("Random Number Generated: ", r, "Image Label : ", test_labels[r])
show(r, 'Image: {}'.format(test_images[rando]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment