Let's see how to build autoencoders to reconstruct handwritten digit images:
- The full code for this recipe is given in the AutoencMnist.py file that has already been provided to you. Let's look at how it's built. Create a new Python file, and import the following package:
from keras.datasets import mnist
- To import the MNIST dataset, the following code must be used:
(XTrain, YTrain), (XTest, YTest) = mnist.load_data()print('XTrain shape = ',XTrain.shape)print('XTest shape = ',XTest.shape)print('YTrain shape = ',YTrain.shape)print('YTest shape = ',YTest.shape)
- After importing the dataset, we have printed the shape of the data, and the following results are returned:
XTrain shape = (60000, 28, 28)XTest shape = (10000, 28, ...