Overview
This module provides hands-on experience building neural network models using real code from Module A8 projects. You’ll implement both dense and convolutional architectures using Keras/TensorFlow and PyTorch.Project Goal: Build an intelligent clothing image classifier using the Fashion-MNIST dataset (28×28 grayscale images, 10 categories).
Dataset: Fashion-MNIST
Loading Data
Visualizing Samples
Binary Classification (Lesson 1)
Problem: Sneaker vs Ankle Boot
Start with a simpler task: distinguish between Zapatilla (7) and Botín (9).Expected Result: ~96-97% accuracy on binary sneaker vs ankle boot classification.
Dense Network for 10 Classes (Lesson 3)
Architecture
Now tackle all 10 clothing categories:Expected Result: ~88-89% test accuracy with dense network.
Convolutional Neural Network (Lesson 4)
Why CNNs for Images?
Dense Networks
• Treat images as flat vectors
• Ignore spatial structure
• Many parameters (overfitting risk)
• ~88% accuracy on Fashion-MNIST
• Ignore spatial structure
• Many parameters (overfitting risk)
• ~88% accuracy on Fashion-MNIST
CNNs
• Exploit 2D spatial structure
• Local pattern detection
• Fewer parameters (weight sharing)
• ~90%+ accuracy on Fashion-MNIST
• Local pattern detection
• Fewer parameters (weight sharing)
• ~90%+ accuracy on Fashion-MNIST
CNN Architecture
Expected Result: ~90-91% test accuracy with CNN - a 2-3% improvement over dense networks!
Comparing Dense vs CNN
Performance Metrics
| Metric | Dense Network | CNN |
|---|---|---|
| Test Accuracy | ~88.9% | ~90.6% |
| Parameters | ~235K | ~225K |
| Training Time | Faster | Moderate |
| Overfitting Risk | Higher | Lower |
Training Curves
Making Predictions
Single Image Prediction
Batch Predictions
Model Evaluation
Confusion Matrix
Classification Report
Per-Class Accuracy
Improving Performance
Data Augmentation
Data Augmentation
Apply random transformations during training to increase dataset diversity.
Batch Normalization
Batch Normalization
Normalize activations between layers for faster, more stable training.
Learning Rate Scheduling
Learning Rate Scheduling
Reduce learning rate as training progresses.
Early Stopping
Early Stopping
Stop training when validation performance plateaus.
Saving and Loading Models
Common Pitfalls and Solutions
Project Results Summary
From the Module A8 Fashion-MNIST classifier:Binary Classification
96-97% accuracy distinguishing sneakers from ankle boots using simple dense network
Dense Network (10 classes)
~88-89% test accuracy with 2-layer dense network and dropout
CNN (10 classes)
~90-91% test accuracy - best performance with convolutional architecture
Complete Training Pipeline
Next Steps
Deep Learning Basics
Review neural network fundamentals and activation functions
Clustering
Explore unsupervised learning techniques
Unsupervised Learning
Return to clustering and dimensionality reduction techniques