Plotting reconstructed images

First, let us plot the actual images, that is, input images:

n = 7
plt.figure(figsize=(20, 4))
for i in range(n):

ax = plt.subplot(1, n, i+1)
plt.imshow(x_test[i].reshape(28, 28))
plt.gray()
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
plt.show()

The plot of the actual images is as follows:

Plot the reconstructed image as follows:

n = 7
plt.figure(figsize=(20, 4))
for i in range(n):
ax = plt.subplot(2, n, i + n + 1)
plt.imshow(reconstructed_images[i].reshape(28, 28))
plt.gray()
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)

plt.show()

The following shows the reconstructed images:

As you can see, the autoencoder has learned better representations of the input images and reconstructed them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset