Next, we simply load the fashion_mnist dataset that's contained in Keras. Note that while we have loaded the labels for each image as well, this is not necessary for the task we are about to perform. All we need are the input images, which our shallow autoencoder will regenerate:
(x_train, y_train), (x_test, y_test) = fashion_mnist.load_data()
x_train.shape, x_test.shape, type(x_train)
((60000, 28, 28), (10000, 28, 28), numpy.ndarray)
plt.imshow(x_train[1], cmap='binary')
Following is the output:
We can proceed by checking the dimensions and types of the input images, and then plot out a single example from the training data for our own visual satisfaction. The example appears to be a casual T-shirt with some undecipherable content written on it. Great – now, we can move on to defining our autoencoder model!