This repository demonstrates deep learning techniques for image classification using the CIFAR-10 benchmark dataset. Through a series of progressively more sophisticated models, it shows how different neural network architectures and training techniques improve classification performance.
Package: The tools developed for this project are available as image-classification-tools on PyPI for use in your own projects.
Documentation: gperdrizet.github.io/CIFAR10
CIFAR-10 consists of 60,000 32×32 color images across 10 classes:
- Training set: 50,000 images (40,000 for training, 10,000 for validation)
- Test set: 10,000 images
- Classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck
01-DNN.ipynb- Baseline fully-connected deep neural network on grayscale images02-CNN.ipynb- Convolutional neural network to exploit spatial relationships03-RGB-CNN.ipynb- CNN modified to process full RGB color information04-optimized-CNN.ipynb- Bayesian hyperparameter optimization with Optuna05-augmented-CNN.ipynb- Data augmentation for improved generalization
- Clone the repository:
git clone https://github.com/gperdrizet/CIFAR10.git
cd CIFAR10- Open in VS Code:
code .-
When prompted, click "Reopen in Container" or use the command palette (Ctrl+Shift+P / Cmd+Shift+P) and select "Dev Containers: Reopen in Container"
-
Wait for the container to build and initialize (first time only). The devcontainer will:
- Set up the Python environment
- Install all dependencies
- Download the CIFAR-10 dataset
Once the container environment loads, you should be all set - you can start running the notebooks! Note: run them in order - some depend on output generated by earlier notebooks.
Models from each experiment are saved in models/pytorch/:
dnn.pth- Baseline DNNcnn.pth- Basic CNNrgb_cnn.pth- RGB CNNoptimized_cnn.pth- Hyperparameter-optimized CNNaugmented_cnn.pth- Optimized CNN trained on augmented data
All experiments use:
- Python 3.10+
- PyTorch 2.0+
- NVIDIA GPU with CUDA support (when available)
Core requirements:
python≥3.10, <3.13torch≥2.0torchvision≥0.15numpy≥1.24matplotlib≥3.7optuna≥3.0scikit-learn≥1.3
See pyproject.toml for complete dependency specifications.
If you find this project helpful for your learning or work, feel free to reference it:
@software{cifar10_tutorial,
author = {Perdrizet, George},
title = {CIFAR-10 Image Classification Tutorial},
year = {2024},
url = {https://github.com/gperdrizet/CIFAR10}
}This project is licensed under the GPLv3 License - see the LICENSE file for details.