Outfit Classifier (Fashion-MNIST)
A from-scratch CNN that recognizes ten clothing categories.
A complete classification pipeline on Fashion-MNIST: preprocessing, a compact convolutional network, training curves and evaluation across T-shirts, trousers, dresses, sneakers, bags and more.
README · rendered from GitHub
Outfit Classifier using CNN
This project builds a complete image classification system that identifies clothing items from the Fashion MNIST dataset. The goal is to train a CNN that can accurately classify outfits such as T-shirt, trouser, pullover, dress, coat, sandal, shirt, sneaker, bag, and ankle boot.
1. Project Overview
This project builds a complete image classification system that identifies clothing items from the Fashion MNIST dataset. The goal is to train a CNN that can accurately classify outfits such as T-shirt, trouser, pullover, dress, coat, sandal, shirt, sneaker, bag, and ankle boot.
Key Objectives
• Load and preprocess the Fashion MNIST dataset • Normalize and reshape images for CNN input • Build and train a CNN model • Evaluate model accuracy and loss • Visualize predictions and misclassifications • Save the trained model for deployment
2. Dataset Description
https://www.kaggle.com/datasets/electraawais/fashion-mnist-dataset
Fashion MNIST CSV dataset contains: • 60,000 training images • 10,000 test images • Each image is 28x28 pixels • Grayscale values from 0 to 255 • CSV structure: first column is label, remaining 784 columns are pixel values
Class Labels
0 T-shirt/top 1 Trouser 2 Pullover 3 Dress 4 Coat 5 Sandal 6 Shirt 7 Sneaker 8 Bag 9 Ankle boot
3. Data Preparation
Steps performed:
- Loaded training and test CSV files using pandas
- Separated labels and pixel data
- Normalized pixel data by dividing values by 255
- Reshaped flattened vectors into CNN-friendly format
Shape used:
(batch, 28, 28, 1) - Converted labels to integer class values
Why normalization helps
• Speeds up convergence • Reduces gradient instability • Helps the CNN learn patterns more smoothly
4. Model Architecture (CNN)
The model is a deep CNN with the following structure:
- Conv2D layer with ReLU activation
- MaxPooling2D
- Second Conv2D with ReLU
- Second MaxPooling2D
- Flatten layer
- Dense layer with 128 units
- Dense output layer with 10 units and softmax
Loss and Optimizer
• Loss function: Sparse Categorical Crossentropy • Optimizer: Adam • Metrics: Accuracy
5. Training Details
• Epochs used: 10 (or your value) • Batch size: 64 • Training performed on the normalized dataset • Validation accuracy monitored using test set
Observations
• Training accuracy steadily increased • Validation accuracy stabilized around the model’s peak point • Overfitting was controlled by moderate depth and pooling layers
6. Evaluation Results
Typical results for this model architecture:
• Test accuracy: approx 88 percent to 92 percent • Test loss: low and stable • Confusion matrix shows common misclassifications between shirt and T-shirt categories
Performance Insights
• CNN captures texture and shape information well • Fashion MNIST is harder than digit MNIST due to similar classes • Model performs strongly on distinct classes such as bag and sneaker
7. Visualizations Included in the Notebook
The notebook contains plots for:
• Sample input images • Training accuracy vs epochs • Training loss vs epochs • Predictions on random test images • Misclassified samples with true vs predicted labels
These visualizations help understand how well the model learns and where it struggles.
8. Model Saving
The trained CNN model is saved as an .h5 file.
This allows:
• Loading the model for inference
• Deployment in applications
• Further fine-tuning on custom datasets
9. Key Takeaways
• CNNs are highly effective for fashion item classification • Proper preprocessing significantly boosts performance • Even simple architectures achieve high accuracy on Fashion MNIST • The system is lightweight and suitable for real use cases
More in AI / ML
Related projects
Private repoAI / MLSummer 2026Trans-Neptunian Object Detection
A spatiotemporal U-Net that finds faint moving objects in telescope image sequences.
- PyTorch
- Python
- HDF5
- CANFAR
AI / ML2023SkinSense: Skin Cancer Classifier
An ensemble of five models labels a lesion as benign or malignant from one RGB image.
- Python
- Scikit-learn
- XGBoost
- LightGBM
AI / ML2025RecycleVision
EfficientNetB0 transfer learning sorts waste into six recyclable categories.
- Python
- TensorFlow
- Keras
- EfficientNetB0