Tensorflow/Keras neural network to train on the MNIST Fashion dataset and classify inputs with 87% accuracy.
The dataset is a collection of images (60,000 for training and 10,000 for testing), each one being an image of 28 by 28 pixels, each pixel being a greyscale value from 0 to 255. Each image has an associated label, which is an integer between 0 and 9, mapping as follows:
Label | Garment type |
---|---|
0 | T-shirt/top |
1 | Trouser |
2 | Pullover |
3 | Dress |
4 | Coat |
5 | Sandal |
6 | Shirt |
7 | Sneaker |
8 | Bag |
9 | Ankle boot |
Adapted/modified/annotated starting from a tutorial by @TechWithTimm.
Python version: 3.7.4
See dependencies.txt for packages and versions (and below to install).
Each image input is a 2D array, representing a 28 by 28 pixel image, with each value being a decimal from 0 to 1 (shrunk down from greyscale 0 to 255 values).
Input layer: 784 neurons (28 * 28), one for each pixel.
One hidden layer: 128 neurons.
Output layer: 10 neurons, one for each of the 10 labels/classes, as integers from 0 to 9. The total of all of the values of this layer's neurons will equal 1. The network's prediction is the neuron with the highest value.
Clone the Git repo.
Install the dependencies:
pip install -r dependencies.txt
python main.py