Skip to content
Vibhrav Jha.Let’s talk

CIFAR-100 with LeNet

Image classification with repeatable training and evaluation

My contributionNetwork, training loop, evaluation and checkpoint handling.

FieldML & AI

View repository

Academic experiment

An experiment that can resume — explanatory architecture diagram

The work
behind the interface.

Made a 100-class image-training experiment resumable through best-model checkpoints and per-epoch evaluation in a roughly 151,000-parameter LeNet implementation.

  • PyTorch
  • Python
  • CIFAR-100

The result

A roughly 151,000-parameter model with checkpointed SGD/momentum training.

The problem

Implemented a LeNet-style classifier for 100 image classes, including training and per-epoch evaluation.

A decision worth examining

Save the best model and support resuming training so experimentation does not depend on one uninterrupted run.

Read the README.

View original README
READMEArchitecture, setup and usage

CIFAR-100 Image Classification with LeNet (PyTorch)

A LeNet-style convolutional neural network, trained from scratch in PyTorch to classify the 100 fine-grained classes of CIFAR-100 (32×32 RGB images).

Model

input 3×32×32
 → Conv2d(3→6, 5×5)  → ReLU → MaxPool 2×2   → 6×14×14
 → Conv2d(6→16, 5×5) → ReLU → MaxPool 2×2   → 16×5×5
 → Flatten                                   → 400
 → Linear(400→256) → ReLU
 → Linear(256→128) → ReLU
 → Linear(128→100)                           → class logits

That's about 151K trainable parameters. forward() returns the logits plus a dictionary of each stage's output shape, which makes it easy to sanity-check the architecture.

Training setup

  • Loss: cross-entropy
  • Optimizer: SGD with momentum 0.9
  • Defaults: learning rate 0.001, batch size 32, 10 epochs (all configurable)
  • After every epoch the model is evaluated on the test set, and a checkpoint is written. The best-accuracy model is saved separately, and training can resume from any checkpoint.

Files

FilePurpose
lenet.pyModel definition, parameter count, train and test loops
dataloader.pyCIFAR-100 dataset: download, extraction, and PyTorch Dataset
train_cifar100.pyTraining entry point with checkpointing and resume
eval_cifar100.pyEvaluate a saved checkpoint on the test set

Usage

pip install -r requirements.txt

python train_cifar100.py --epochs 10 --lr 0.001 --batch-size 32
python train_cifar100.py --resume outputs/checkpoint.pth.tar      # continue training
python eval_cifar100.py --load outputs/model_best.pth.tar

Data is cached under data/ and checkpoints are written to outputs/. Neither is committed.


Date finished: April 7, 2025

Fashion-MNIST Classifier

  1. Aranyaka wildlife-image application interface

    Fullstack

    Aranyaka

  2. DermaNet hackathon prototype showing classification output and a generated explanation

    ML & AI

    DermaNet

  3. AI-generated concept illustration of source documents connected to retrieved evidence and an answer

    ML & AI

    Private-Data RAG

  4. Before It Breaks dashboard separating real weather from synthetic equipment telemetry and estimated costs

    ML & AI

    Before It Breaks

  5. Architecture diagram of simulated stock records flowing through Kafka to HDFS

    Distributed Systems

    Stock Streaming Engine

  6. Vyaya dashboard with clearly labeled synthetic demonstration data

    Fullstack

    Vyaya

  7. Study assistant interface with retrieved source context

    ML & AI

    Fine-Tuning vs. RAG

  8. Architecture diagram of NOAA data, a Cassandra cluster and a query service

    Distributed Systems

    Distributed Weather Data System

  9. Distributed Property Lookup Service project image

    Distributed Systems

    Distributed Property Lookup Service

  10. Architecture diagram connecting MySQL, a gRPC service and HDFS storage

    Distributed Systems

    HDFS & SQL Pipeline

  11. Architecture diagram of Spark processing, SQL and analysis

    Distributed Systems

    Spark Analytics

  12. Multi-Source ELT Pipeline project image

    Data Engineering

    Multi-Source ELT Pipeline

  13. Wisconsin schools in their geographic context — explanatory architecture diagram

    Data Engineering

    GCP Geospatial Pipeline

  14. Chinook Music Store SQL Analytics project image

    Data Engineering

    Chinook Music Store SQL Analytics

  15. Yelp Geospatial Analytics project image

    Data Engineering

    Yelp Geospatial Analytics

  16. E-Commerce Semantic Search Engine project image

    Data Engineering

    E-Commerce Semantic Search Engine

  17. Retail Sales Forecasting project image

    ML & AI

    Retail Sales Forecasting

  18. Making tool dependencies inspectable — explanatory architecture diagram

    ML & AI

    AI Agent Tool Dependency Graph

  19. From public records to operational questions — explanatory architecture diagram

    Data Engineering

    Palantir Foundry and AIP Build Challenge

  20. StudyFlow study-session dashboard

    Fullstack

    StudyFlow

  21. Habit Command Center planning dashboard

    Fullstack

    Habit Command Center

  22. Interfaces across web and mobile — explanatory architecture diagram

    Fullstack

    React Web & Mobile

  23. Startup Scout project image

    Fullstack

    Startup Scout

  24. Inventory-Based Recipe Planner project image

    Fullstack

    Inventory-Based Recipe Planner

  25. Concurrent Word Count and Performance Benchmarking project image

    Data Engineering

    Concurrent Word Count

  26. Data structures matched to their assumptions — explanatory architecture diagram

    Computing Foundations

    Algorithm Design

  27. Campus Navigator project image

    Fullstack

    Campus Navigator

  28. i-Songly: Song Management Engine project image

    Fullstack

    i-Songly

  29. An experiment that can resume — explanatory architecture diagram

    ML & AIViewing

    CIFAR-100 with LeNet

  30. Fashion-MNIST Neural Network Classifier project image

    ML & AI

    Fashion-MNIST Classifier

  31. PCA Eigenfaces and Image Reconstruction project image

    ML & AI

    PCA Eigenfaces

  32. Two routes to the same regression objective — explanatory architecture diagram

    ML & AI

    Lake Mendota Ice Regression

  33. Bayesian Language Detection project image

    ML & AI

    Bayesian Language Detection

  34. Explanatory diagram of the video-fingerprint benchmark: 25 sources, 75 transformed variants and 1,875 comparisons.

    ML & AI

    Video-Fingerprint Benchmark

All projects