Built to order

Dog Breed Classification using Transfer Learning

A fine-grained image classifier that identifies dog breeds from photos using transfer learning: a ResNet (He et al. 2016) pretrained on ImageNet is fine-tuned on the Stanford Dogs dataset (Khosla et al. 2011) — 20,580 images across 120 breeds. The included training notebook applies augmentation and a documented train/validation split, logging accuracy and loss curves and computing a confusion matrix during the training run (design target ~85%+ validation accuracy). A demo app serves predictions with top-3 breeds and confidence scores.

Thumbnail for Dog Breed Classification using Transfer Learning: a dog photo representing the ResNet classifier trained on Stanford Dogs.
More project photos (2)

The problem

Telling a Siberian Husky from an Alaskan Malamute is hard for people and harder for models: 120 breeds differ in fine details of coat, ears and muzzle that shallow features cannot separate. Training a deep 120-way classifier from scratch would demand enormous labeled data and student-unfriendly hardware — so this build uses transfer learning. A ResNet (He et al., CVPR 2016), pretrained on ImageNet, already knows edges, textures and object parts; its residual skip connections let gradients flow through very deep networks, which is what captures the fine detail separating breeds. The training notebook fine-tunes it on the Stanford Dogs dataset (Khosla et al. 2011) — 20,580 annotated images across 120 breeds — with augmentation and a documented train/validation split. Each run logs accuracy and loss curves and computes a validation confusion matrix with a per-breed breakdown naming the confused pairs, so the report's metrics come from the run itself (design target ~85%+). A demo app serves top-3 predictions with confidence scores and Grad-CAM overlays.

How it works

Dataset & model:
Dataset name: Stanford Dogs (Khosla et al., CVPR Workshop on Fine-Grained Visual Categorization, 2011). Source: the public release — 20,580 annotated images across 120 dog breeds. Task: fine-grained image classification. Classes: 120 dog breeds (e.g. Siberian Husky, Alaskan Malamute). A seeded train/validation split is documented in the report.
Model: ResNet with residual connections (He et al., "Deep Residual Learning for Image Recognition", CVPR 2016), fine-tuned from ImageNet-pretrained weights with a replaced 120-way classifier head.
Input: a dog photo (JPEG/PNG), auto-resized and normalized. Prediction: softmax scores over the 120 breeds. Output: top-3 predicted breeds with confidence scores, plus Grad-CAM heatmaps.
Evaluation metrics: validation accuracy, accuracy/loss curves, and a confusion matrix with per-breed breakdown on the validation split — all computed by the training notebook during the build. Design target: ~85%+ validation accuracy — a target for the training run, not a pre-claimed score.

Working:

  1. Dataset: Stanford Dogs images (20,580 across 120 breeds) are organized by breed label and split into train and validation sets with a fixed seed for reproducibility.
  2. Preprocessing: training images pass through augmentation — random resized crops, horizontal flips, color jitter, rotations — while validation images are only resized and normalized.
  3. Training phase: an ImageNet-pretrained ResNet is fine-tuned in two stages — the replaced 120-way classifier head is trained first, then deeper layers are unfrozen with a low learning rate.
  4. Logging: each epoch logs training and validation accuracy and loss; the best checkpoint is saved by validation accuracy.
  5. Evaluation phase: a confusion matrix with a per-breed accuracy breakdown is computed on the validation split during the build — the report's metrics come from this run, against the design target of ~85%+ validation accuracy.
  6. Inference phase (demo): the app loads the best weights at startup; an uploaded photo is preprocessed identically to validation images and passed through the model; softmax scores are ranked into top-3 breed predictions with confidence bars, and Grad-CAM overlays show the attended regions.

Specifications:
Model | ResNet with residual connections (He et al., 2016), fine-tuned from ImageNet weights
Dataset | Stanford Dogs — 20,580 images across 120 breeds (Khosla et al. 2011)
Split | Seeded train/validation split, documented in the report
Metric | Validation accuracy, loss curves and confusion matrix with per-breed breakdown, computed during the build; design target ~85%+
Augmentation | Random resized crops, flips, color jitter, rotations on training images
Input | Dog photos (JPEG, PNG), auto-resized and normalized
Output | Top-3 breed predictions with confidence scores, plus Grad-CAM overlays
Demo app | Flask web app with upload UI and prediction display
Weights | .pth file shipped with the build, plus Grad-CAM visualization support

Project features

ResNet Breed Classifier [implemented] — ImageNet-pretrained ResNet fine-tuned on 120 dog breeds, with a replaceable 120-way classifier head.
Two-Stage Fine-Tuning [implemented] — Classifier head trained first, then deeper layers unfrozen at a low learning rate for stable convergence.
Training Notebook with Full Logging [implemented] — Accuracy and loss curves every epoch, plus a validation confusion matrix computed during the build.
Augmentation Pipeline [implemented] — Random crops, flips, color jitter and rotations on training images.
Demo App with Top-3 Predictions [implemented] — Upload a dog photo and get the top-3 predicted breeds with confidence scores and bars; the confidence threshold and top-k display are configurable in the demo config.
Grad-CAM Visualizations [implemented] — Heatmaps showing which regions drove each prediction.
Per-Breed Accuracy Breakdown [implemented] — The confusion matrix names the most-confused breed pairs explicitly, for report error analysis.
Exportable .pth Weights [implemented] — The checkpoint suits deployment-style demos.

What is included

Complete source code: data pipeline, training, evaluation, Flask demo app
Trained ResNet weights (.pth)
Dataset download and split-configuration scripts
Project report PDF: background, dataset analysis, methodology, evaluation, error analysis
PPT presentation for final review
Viva Q&A preparation document: residual connections, transfer learning, fine-grained classification, evaluation metrics
Setup guide: environment, dependencies, GPU guidance for training

Limitations & prerequisites

Fine-grained breeds are the main error source — visually near-identical breeds (e.g. husky vs malamute) confuse the model, as the confusion matrix shows.
The dataset skews toward well-framed photos of single dogs; occluded, multi-dog or low-light photos classify worse.
The classifier is closed-set over the 120 Stanford Dogs breeds; mixed-breed or off-list dogs get the nearest-looking label.
The ~85%+ figure is a design target for the training run, not a pre-measured claim.
This is an educational prototype, not a certified breed-identification service — it must not drive pedigree, insurance or sale decisions.

Frequently Asked Questions

What is transfer learning and why is it used here?

Transfer learning reuses a network trained on one large task (ImageNet) as the starting point for a related task (dog breeds). The pretrained layers already detect edges, textures and shapes, so fine-tuning needs far less data and trains far faster than starting from random weights.

What is special about ResNet?

ResNet (He et al., CVPR 2016) introduced residual (skip) connections that let gradients flow through very deep networks without vanishing. That depth is what lets the model learn the fine details separating 120 breeds.

What dataset does the model train on?

The Stanford Dogs dataset (Khosla et al. 2011) — 20,580 annotated images across 120 dog breeds. The report documents the train/validation split used in the build.

Which breeds does it confuse most?

Near-identical breed pairs are the classic failure mode; the per-breed breakdown from the confusion matrix names them explicitly — strong error-analysis material for the viva.

Can it handle mixed-breed dogs?

No — it is a closed-set classifier over the 120 Stanford Dogs breeds. Mixed-breed or off-list dogs get the nearest-looking breed label, which the report documents openly.

Is this project suitable for a final-year project?

Yes — for B.E./B.Tech Computer Science, AI/ML and Data Science students. It covers transfer learning, residual networks, fine-grained classification, and confusion-matrix error analysis, with a demo examiners can test on their own dog photos.

Components & software requirements

Python 3.10
PyTorch (training, validation, inference)
torchvision (pretrained ResNet, transforms, augmentation)
NumPy and scikit-learn (metrics, confusion matrix)
Matplotlib and Seaborn (accuracy and loss curves)
Flask (demo web application)
Stanford Dogs dataset, 20,580 images / 120 breeds (download and split scripts included)
Trained ResNet weights as .pth, exported from the included training run; a GPU is recommended for training (cloud-GPU guidance included)

Delivery information

Built-to-order. The two-stage ResNet fine-tuning run on Stanford Dogs (the pacing item), the confusion-matrix evaluation, the demo app, and the full documentation kit (report, PPT, viva Q&A, setup guide) are prepared fresh for the buyer. The exact build schedule is confirmed at quotation.

Support terms
  • Setup guidance: environment, dependencies, dataset download, GPU/cloud-GPU options for training
  • Viva preparation: residual connections, transfer learning, fine-grained vs coarse classification, reading confusion matrices, Grad-CAM interpretation
  • Customization discussion: new breed classes, UI changes, larger breed sets (feasibility confirmed before quoting)

Download abstract (PDF)

Related guides

All guides
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Illustration of Whisper speech-to-text showing sound waves flowing into a neural network and emerging as transcribed text with timestamps and speaker labels.B.E./B.Tech Computer Science and AI/ML students adding speech-to-text to projects — voice assistants, meeting transcription, accessibility tools

Whisper for Speech-to-Text in Student Projects

Whisper transcribes speech in dozens of languages with no training required. This guide covers how it works, choosing among model sizes, running it locally with faster-whisper, handling hour-long audio, timestamps and speaker diarization, multilingual quirks, and honest evaluation with word error rate.

Read guide
Get a quotation