Data & AI Project
Image Classifier
Transfer learning takes a model already trained on millions of images and adapts it to your problem with a few hundred, by replacing the final layer and fine-tuning. It is how essentially all production computer vision is built — training from scratch is rare, expensive and usually worse.
The brief
Collect or find a small labelled image dataset, fine-tune a pretrained model on it, and evaluate honestly. Analyse what it gets wrong and why, then serve it behind an API that accepts an upload.
What it demonstrates
That you understand why transfer learning wins, and that you did error analysis instead of reporting one accuracy number.
What "done" looks like
Build all of these and the project is finished. Anything past that is in the stretch goals.
- A labelled dataset with a documented collection method
- A pretrained backbone fine-tuned on it
- Augmentation that reflects real variation
- Per-class metrics and a confusion matrix
- Written error analysis of the actual failures
- An API accepting an image upload and returning a prediction
How to build it
- 1
Assemble the dataset
A few hundred images per class, balanced. Split before you touch anything, so nothing leaks into validation.
- 2
Build the input pipeline
Resize, normalise and augment — flips, crops, colour jitter that match real variation rather than arbitrary noise.
- 3
Fine-tune the head first
Freeze the backbone, train the new classifier, get a baseline. Fast, and it tells you the data is wired correctly.
- 4
Unfreeze carefully
Release the top layers at a much lower learning rate. Unfreezing everything at once destroys the features you came for.
- 5
Tune the training loop
Learning-rate schedule, early stopping, checkpointing on the best validation score.
- 6
Evaluate per class
A confusion matrix, not one accuracy number. The pattern in the errors is the finding.
- 7
Do the error analysis
Look at the misclassified images. Mislabelled data, an ambiguous class, or a real weakness — you cannot tell without looking.
- 8
Serve and containerise
An upload endpoint with the same preprocessing as training, in a Docker image. Skew here is a classic silent bug.
Once it works
Only after the definition of done is met. Half-finished ambition reads worse than a small finished thing.
- Add Grad-CAM so predictions can be visually explained
- Export to ONNX and compare inference speed
- Add an active-learning loop over the most uncertain predictions
Frequently Asked Questions
How many images do I need per class?
With transfer learning, a few hundred per class often suffices, and sometimes as few as fifty with strong augmentation. Balance matters more than volume — a class with ten examples against another with a thousand will be learned badly regardless of the total.
Should I freeze the base model?
Freeze it first and train only the new head, which is fast and establishes a baseline. Then unfreeze the top layers with a much lower learning rate. Unfreezing everything immediately usually destroys the pretrained features you came for.
Why does error analysis matter more than accuracy?
Because 94% accuracy tells you nothing about which 6% fails, and the pattern in the failures is where the next improvement lives. Look at the confusion matrix and at the actual misclassified images — it is the most useful hour in the project.