Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # reading the training images matrix
  2. train = mnist.train.images
  3. image_dim = 28
  4. # printing some images with their labels
  5. plt.figure(1)
  6.  
  7. for i in range(25):
  8. plt.subplot(5,5,i+1)
  9. flatten_img = train[i]
  10. # recreating the 28*28 image matrix from feature vector
  11. img = flatten_img.reshape([image_dim,image_dim])
  12. # Scaling it to [0,255] range -- greyscale
  13. img = np.uint8(img*255)
  14. plt.axis('off')
  15. plt.imshow(img,cmap='gray')
  16. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement