Facebook
From Reliable Pheasant, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 222
  1. encoded_imgs = encoder.predict(x_test)
  2. decoded_imgs = decoder.predict(encoded_imgs)
  3.  
  4. n = 10
  5. plt.figure(figsize=(20, 6))
  6. for i in range(n):
  7.     # display original
  8.     ax = plt.subplot(3, n, i + 1)
  9.     plt.imshow(x_test[i].reshape(28, 28))
  10.     plt.gray()
  11.     ax.get_xaxis().set_visible(False)
  12.     ax.get_yaxis().set_visible(False)
  13.  
  14.     # display reconstruction
  15.     ax = plt.subplot(3, n, i + 1 + n)
  16.     plt.imshow(encoded_imgs[i].reshape(6, 6))
  17.     plt.gray()
  18.     ax.get_xaxis().set_visible(False)
  19.     ax.get_yaxis().set_visible(False)
  20.    
  21.    
  22.     # display reconstruction
  23.     ax = plt.subplot(3, n, i + 1 + 2*n)
  24.     plt.imshow(decoded_imgs[i].reshape(28, 28))
  25.     plt.gray()
  26.     ax.get_xaxis().set_visible(False)
  27.     ax.get_yaxis().set_visible(False)
  28.    
  29. plt.show()