Clothing classifier on Fashion-MNIST
Small convolutional networks trained from scratch to recognise ten kinds of clothing, compared one design change at a time. The best one runs in your browser on real test pictures.
- When
- Spring 2022
- Where
- MSc coursework, Computer Vision course at Utrecht University, in a group of two
- Built with
- Python, TensorFlow, Keras, CNN
- Made as
- Team project
Try it yourself
Pick a test picture
Click any picture and the trained network classifies it straight away, here in your browser: no server is involved. It is our max-pooling model from the report, with its saved weights, run by a small forward pass in plain JavaScript. The bars show how sure it is of each of the ten classes.
The model says
Loading the model…
In pictures


About the project
The problem. Image classification: given a picture, say which class it belongs to. Fashion-MNIST is a standard benchmark of clothing pictures in ten classes, such as ankle boots, shirts and coats. We trained small convolutional neural networks (CNNs) on it from scratch and compared design choices one at a time.
The baseline. A CNN learns its own image filters. A convolution layer slides small filters over the picture, each one responding to a pattern such as an edge or a texture; the first picture shows what the first layer's filters pick up in an ankle boot. A pooling layer then shrinks the result by keeping one value per small patch, the average or the maximum, so later layers see larger parts of the image. Fully connected layers at the end turn everything into a score per class. Our baseline was in the spirit of LeNet-5, a classic early CNN: two convolution layers, each followed by pooling, then three fully connected layers. It was trained for 15 epochs (passes over the training set) with the Adam optimiser and L2 regularisation, a penalty on large weights that helps against overfitting, where a model memorises its training pictures instead of learning what generalises.
The variants. We then changed one thing at a time and compared:
- max pooling instead of average pooling;
- more filters;
- an extra convolution layer;
- dropout, which switches off a random part of the network at each training step so it cannot lean on any single connection;
- a learning rate halved every five epochs, so training takes smaller steps as it settles.
The result. Max pooling won, with 89.5% of the test pictures right in our report. Shirts are the hardest class: the confusion matrix, a table of true class against predicted class, shows the model mixing them up with coats and with T-shirts and tops.
The demo. The demo on this page runs the weights we saved for the max-pooling model. I checked them again for this page: 89.6% on the 10,000 test pictures.
My part. I wrote the training script and the notebook that compare the model variants, and submitted the final version.




