Plotting the reconstructed images

The last step is to print the reconstructed images to give us visual proof of how the encoder is able to reconstruct the images based on the weights:

predicted_imgs = autoencoder.reconstruct(X_test[:100])# plot the reconstructed imagesplt.figure(1, figsize=(10, 10))plt.title('Autoencoded Images')for i in range(0, 100):    im = predicted_imgs[i].reshape((28, 28))    ax = plt.subplot(10, 10, i + 1)    for label in (ax.get_xticklabels() + ax.get_yticklabels()):        label.set_fontname('Arial')        label.set_fontsize(8)    plt.imshow(im, cmap="gray", clim=(0.0, 1.0))plt.suptitle('Additive Gaussian Noise AutoEncoder Images', fontsize=15, y=0.95)plt.savefig('figures/additive_gaussian_images.png')plt.show()
Reconstructed images using the ...

Get Neural Network Programming with TensorFlow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.