Detecting MNIST handwritten digits
When you design a neural network, you usually start with a problem that you want to solve, and you might start with a design that you know performs well on a similar task. You need a dataset, basically as big a dataset as you can get. There is not really a rule on that, but we can say that the minimum to train your own neural network might be something around 3,000 images, but nowadays world-class CNNs are trained using literally millions of pictures.
Our first task is to detect handwritten digits, a classical task for CNNs. There is a dataset for that, the MNIST dataset (copyright of Yann LeCun and Corinna Cortes), and it is conveniently present in Keras. MNIST detection is an easy task, so we will achieve good results.
Loading the dataset is easy:
from keras.datasets import mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train = np.reshape(x_train, np.append(x_train.shape, (1))) x_test = np.reshape(x_test, np.append(x_test...