Akanksha Tyagi

Fashion-MNIST Image Classification

Compared classical and deep models on Fashion-MNIST, reaching 93.39% test accuracy with a deeper CNN.

MS coursework · University of Arkansas · Fall 2025 · Individual project

Built with Python, PyTorch, scikit-learn, CNN, SVM and PCA.

Problem

Fashion-MNIST is a standard benchmark of small grayscale photos of clothing: 28 by 28 pixels, ten classes such as T-shirt, trouser, coat, sandal and bag, and a test set of 10,000 images. Some classes look much alike at that size. A shirt, a T-shirt and a coat differ mostly in the neckline and sleeves.

This was an individual project for an MS machine learning course. The question was how far each family of model gets on the same data, from a classical support vector machine to a convolutional network, and what it takes to close the gap.

Two rows of three copies of the same grayscale clothing image, 28 by 28 pixels shown enlarged. Top row: ground truth Dress; CNN prediction Dress, correct; NN prediction Coat, wrong. Bottom row: ground truth Shirt; CNN prediction Shirt, correct; NN prediction T-shirt/top, wrong.
Two Fashion-MNIST images, a dress and a shirt, as my plotting code drew them, with what my CNN and my fully connected network (NN) predicted for each. The CNN gets both right. The fully connected network calls the dress a coat and the shirt a T-shirt, classes that look much alike at this size. Images from Fashion-MNIST by Zalando Research.View full size (opens in a new tab)

Approach

I built every model in one codebase, with a configuration file per experiment so each run could be repeated and compared.

  • Classical baseline. I reduced each image to its main components with principal component analysis (PCA) and trained a support vector machine (SVM) with a radial basis function kernel on them, testing how many components to keep. I also trained a plain fully connected network on the pixels.
  • Convolutional network. The SVM and the fully connected network both see an image as one long row of pixels, which throws away which pixels are next to each other. A convolutional neural network (CNN) keeps the 2D layout and learns local shapes such as edges and curves. My baseline CNN used the Adam optimizer at a fixed learning rate of 0.002, with no dropout and no schedule.
  • Tuned CNN. I then added a third convolutional layer, dropout of 0.3, the AdamW optimizer with weight decay, and a cosine schedule that lowers the learning rate smoothly over training.
  • A sanity check. Finally I collapsed the ten classes into two, footwear (sandal, sneaker, ankle boot) and everything else, to see how well the CNN captures overall shape.
Line chart titled Test Accuracy vs Dimensionality: SVM-RBF test accuracy in percent against the number of PCA components, on a log scale, five points. The highest point is at 100 components; the points for more components are all lower.
Test accuracy of my SVM against the number of principal components it keeps, on a log scale. It peaks at 100 components, and keeping more did not help.View full size (opens in a new tab)

Results & Impact

Test accuracy on the 10,000 test images:

  • SVM on PCA features, best at 100 components: 86.62%
  • SVM and standard fully connected network, best runs: both topped out near 88%
  • Baseline CNN: 90.87%
  • Deeper CNN with dropout, AdamW and a cosine schedule: 93.39%
Line chart titled Training and Validation Loss for the baseline CNN, loss against epoch. Train loss in blue falls steadily. Validation loss in red jumps up early, then falls, then rises again over the last epochs.
Training loss (blue) and validation loss (red) of my baseline CNN. The validation loss jumps early in training and drifts back up at the end.View full size (opens in a new tab)

The baseline CNN beat the SVM on PCA features by more than 4 points and reached a weighted F1 score of 0.91, a sign that keeping the image's spatial structure matters on this data. The tuned network raised accuracy to 93.39% with a weighted F1 of 0.93, and its loss curve was smoother and steadier than the baseline's.

Line chart titled Training and Validation Loss for the tuned CNN, loss against epoch. Train loss in blue and validation loss in red both fall and end lower than the baseline's, with the validation loss levelling off instead of rising at the end.
The same curves for the tuned CNN with dropout, AdamW and the cosine schedule. Both losses end lower than the baseline's (the scales differ), and the validation loss levels off instead of climbing at the end.View full size (opens in a new tab)

The confusion matrices showed where the remaining errors are. Shirt was the hardest class, most often mistaken for T-shirt or coat. The tuned CNN improved it but did not solve it. On the footwear task the CNN made only 14 mistakes in 10,000 test images. Telling a shoe from a piece of clothing is easy for it. The hard part is telling similar tops apart.