CIFAR-100 Image Classification

Exploring CNN architectures, noise robustness, and transfer learning on 100-class image recognition

🎯 69.1% Top-1 Accuracy 🖼️ 60,000 Images · 100 Classes 🧠 PyTorch · CNN · VGG-16

01Project Overview

Building and evaluating convolutional neural networks for fine-grained image classification

This project investigates CNN-based approaches for classifying images from CIFAR-100 — a challenging benchmark with 100 fine-grained categories and only 500 training images per class. We explore models trained from scratch, evaluate robustness to Gaussian noise, implement noise-augmented training for improved resilience, and compare against VGG-16 transfer learning.

69.1%
Best Clean Test Accuracy (CNN)
47.3%
Best Noisy Accuracy (Noise-Aug)
63.3%
VGG-16 Transfer Learning
~2.4M
CNN Parameters

02Dataset & Preprocessing

CIFAR-100: 60,000 32×32 color images across 100 classes

Data Split

  • Training: 45,000 images
  • Validation: 5,000 images
  • Test: 10,000 images

Augmentation & Normalization

  • Channel-wise normalization (μ, σ per channel)
  • RandomCrop(32, padding=4)
  • RandomHorizontalFlip
  • Batch size: 128

03CNN from Scratch

A moderate-depth CNN with progressive regularization

Block 1
Conv(3→64) · BN · ReLU
Conv(64→64) · BN · ReLU
MaxPool · Dropout(0.2)
Block 2
Conv(64→128) · BN · ReLU
Conv(128→128) · BN · ReLU
MaxPool · Dropout(0.3)
Block 3
Conv(128→256) · BN · ReLU
Conv(256→256) · BN · ReLU
MaxPool · Dropout(0.4)
Classifier
AdaptiveAvgPool(1,1)
FC(256→512) · ReLU
Dropout(0.5) · FC(512→100)

Training Configuration

  • Optimizer: Adam (lr=1e-3, weight_decay=5e-4)
  • Scheduler: CosineAnnealingLR (T_max=100)
  • Loss: CrossEntropyLoss
  • Epochs: 100
  • Init: Kaiming He (fan_out, ReLU)
79.5%
Training Accuracy
69.0%
Validation Accuracy
69.1%
Test Accuracy
A1 Training Curves
Training and validation loss/accuracy curves over 100 epochs. Cosine annealing provides smooth convergence with a ~10% train-val gap indicating moderate overfitting.

04Noise Robustness

Evaluating and improving resilience to Gaussian noise (σ²=0.05)

Clean vs Noisy Images
Visual comparison of clean CIFAR-100 images and their noisy counterparts with additive Gaussian noise (σ²=0.05). The noise severely corrupts the low-resolution 32×32 images.

Noise Model

Additive zero-mean Gaussian noise: x_noisy = clamp(x + ε, 0, 1) where ε ~ N(0, 0.05)

Standard CNN under Noise

ConditionAccuracyDrop
Clean Test69.1%
Noisy Test1.2%−67.8%
Finding: The model trained exclusively on clean data collapses to near-random performance under noise — features learned are not noise-invariant.

Noise-Augmented Training

During training, 30% of samples are corrupted with the same Gaussian noise. The model learns noise-invariant features while preserving clean accuracy.

ConditionStandard CNNNoise-Augmented CNN
Clean Test69.1%64.9%
Noisy Test1.2%47.3%
Accuracy Drop67.8%17.6%
A3 Training Curves
Noise-augmented CNN training curves. The train-val gap is narrower than the clean-only model, showing better generalization due to the regularization effect of noise injection.

05Transfer Learning with VGG-16

Leveraging ImageNet-pretrained features for CIFAR-100

Approach

  • Load pretrained VGG-16 (ImageNet weights)
  • Resize CIFAR-100 images: 32×32 → 224×224
  • Freeze all convolutional layers (feature extractor)
  • Extract 512-d features via AdaptiveAvgPool
  • Train lightweight MLP classifier: FC(512→256) → ReLU → Dropout(0.5) → FC(256→100)
63.3%
Clean Test Accuracy
1.5%
Noisy Test Accuracy
~157K
Trainable MLP Parameters
Observation: VGG-16 transfer learning achieves competitive accuracy (63.3%) with only 157K trainable parameters, but is equally vulnerable to noise (1.5% noisy accuracy), suggesting ImageNet features are not inherently noise-robust.

06Comprehensive Comparison

All experiments side-by-side

ModelClean AccNoisy AccDropParams
bestCNN (scratch) 69.1%1.2%67.8%~2.4M
robustCNN (noise-aug) 64.9%47.3%17.6%~2.4M
transferVGG-16 + MLP 63.3%1.5%61.8%138M + 157K
Comprehensive Comparison
Clean vs noisy test accuracy and robustness comparison across all models. Noise-augmented training dramatically reduces accuracy drop under noise.

Key Takeaways

  • Best clean accuracy: CNN from scratch (69.1%) — small and effective
  • Best robustness: Noise-augmented CNN — smallest accuracy drop (17.6%) with competitive clean performance
  • Transfer learning: VGG-16 provides strong results with minimal training, but offers no noise robustness
  • Most efficient: CNN from scratch — 2.4M params vs 138M+ for VGG

07Model Output Comparison

Comprehensive Comparison Of Output
Clean vs noisy test output across all models.