Classify 37 cat and dog breeds from a photo, using transfer learning with a pretrained ResNet on the Oxford-IIIT Pet dataset. Trained on an NVIDIA RTX 4050 (6 GB) laptop GPU, with an interactive Gradio demo.
- Build an image-classification pipeline in PyTorch (datasets, transforms, DataLoaders).
- Use transfer learning (a pretrained ResNet) instead of training from scratch.
- Train on the GPU, evaluate with accuracy and a confusion matrix.
- Ship an interactive Gradio demo you can drop any pet photo into.
pytorch-image-classifier/
├── data/ # Oxford-IIIT Pet, auto-downloaded (not committed)
├── models/ # trained checkpoints (not committed)
├── notebooks/
├── src/
│ ├── data.py # transforms + DataLoaders
│ ├── check_gpu.py # confirms CUDA/GPU is visible
│ └── ...
├── app/ # Gradio demo (Day 3)
├── requirements.txt
└── README.md
# 1. Virtual environment
python -m venv venv
venv\Scripts\Activate.ps1
# 2. GPU-enabled PyTorch (CUDA 12.8 build)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
# 3. Everything else
pip install -r requirements.txt
# 4. Confirm the GPU is visible
python src/check_gpu.pyOxford-IIIT Pet: 37 breeds, ~7,400 images. Auto-downloads through torchvision on
first run into data/. No manual download needed.
- Day 1: setup, GPU-enabled PyTorch, data pipeline
- Day 2: transfer-learning model + training loop (on GPU)
- Day 3: evaluation + Gradio demo