(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() import matplotlib.pyplot as plt image_index = 7777 # You may select anything up to 60,000 print(y_train[image_index]) # The label is 8 plt.imshow(x_train[image_index], cmap=‘Greys') # Reshaping the array to 4-dims so that it can work with the Keras API x_train = x_train.reshape(x_train.shape[0], 28, 28, 1) x_test = x_test.reshape(x_test.shape[0], 28, 28, 1) input_shape = (28, 28, 1) # Making sure that the values are float so that we can get decimal points after division x_train = x_train.astype('float32') x_test = x_test.astype('float32') # Normalizing the RGB codes by dividing it to the max RGB value. x_train /= 255 x_test /= 255 print('x_train shape:', x_train.shape) print('Number of images in x_train', x_train.shape[0]) print('Number of images in x_test', x_test.shape[0])