https://github.com/reneking-tech/cifar10-lightning
Hands-on deep learning with PyTorch & Lightning β CIFAR-10 classification
https://github.com/reneking-tech/cifar10-lightning
ai cifar10 cnn deep-learning image-classification machine-learning ml-engineering model-evaluation notebooks python pytorch pytorch-lightning transfer-learning
Last synced: about 2 months ago
JSON representation
Hands-on deep learning with PyTorch & Lightning β CIFAR-10 classification
- Host: GitHub
- URL: https://github.com/reneking-tech/cifar10-lightning
- Owner: reneking-tech
- Created: 2025-05-06T10:40:17.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-06T12:43:01.000Z (about 1 year ago)
- Last Synced: 2025-05-08T02:52:53.168Z (about 1 year ago)
- Topics: ai, cifar10, cnn, deep-learning, image-classification, machine-learning, ml-engineering, model-evaluation, notebooks, python, pytorch, pytorch-lightning, transfer-learning
- Language: Jupyter Notebook
- Homepage:
- Size: 112 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π§ CIFAR-10 Classifier: From PyTorch to Lightning
This project demonstrates how to build and train a simple Convolutional Neural Network (CNN) on the CIFAR-10 image classification dataset using both **vanilla PyTorch** and **PyTorch Lightning**.
It was created as a practical, hands-on learning journey after completing Andrew Ng's Machine Learning Specialization. The goal: go from foundational ML understanding to real model implementation and training.
---
## π Whatβs Inside
- β
CIFAR-10 data loading with torchvision
- π§± CNN architecture (`SimpleCNN`)
- π Custom training + validation loops
- β‘ PyTorch Lightning module (`LitCNN`)
- π Loss/accuracy visualization
- π‘ Reflections on overfitting + improvements
- β
Pre-commit auto-formatting, notebook cleaning, code linting
---
## π Training Results
### Vanilla PyTorch (5 Epochs)
- Final **Train Acc:** ~98%
- Final **Val Acc:** ~71%
- β Validation loss increased β signs of **overfitting**
### PyTorch Lightning (5 Epochs)
- Final **Val Loss:** ~0.83
- Final **Val Accuracy:** ~71.2%
> π Same accuracy, but Lightning yielded a cleaner validation curve and easier setup.
---
## πΌοΈ Training Curves
### π½ Loss

### πΌ Accuracy

> _Outputs were stripped using pre-commit to keep this repo clean._
---
## π§ Reflections
Despite strong training performance, the validation metrics suggest overfitting. This provides a clear path to improvement:
- β
Add dropout layers
- β
Use weight decay
- β
Apply data augmentation (`RandomCrop`, `HorizontalFlip`)
- β
Explore more expressive architectures or learning rate schedulers
---
## β
Pre-Commit Enabled

This project uses [`pre-commit`](https://pre-commit.com/) to ensure:
- Clean `.ipynb` notebooks (`nbstripout`)
- Consistent code style (`black`, `isort`)
- Valid YAML + JSON
- No trailing whitespace or newline issues
To install:
```bash
pip install pre-commit
pre-commit install