Brief #23 · Machine Learning

On-Device Image Classifier

Medium⏱ 12-18 hSoon

Fine-tune an image classifier with transfer learning, then shrink it until it runs fast on a cheap phone, measuring exactly what each trick costs in accuracy.

Outlines are free · building with tracking needs Pro

OThe briefFrom the team

Field agents photograph crop leaves to report disease, but villages have weak internet, so uploading photos to a server fails half the time. Build a model that recognises the common diseases right on a budget Android phone, offline, in well under a second, and tell us how much accuracy we give up for that.

What you'll build

  1. 1Fine-tune a pretrained CNN on a public plant-disease dataset with data augmentation, and record validation accuracy.
  2. 2Compare a large backbone with a mobile-sized one on accuracy, model size and speed.
  3. 3Export to ONNX or TFLite and apply 8-bit quantization, checking accuracy after each step.
  4. 4Run it in a small Android or web demo and measure on-device latency for 100 images.
  5. 5Look at the mistakes: which diseases get confused, and show the images.

Step-by-step walkthrough

Walkthrough coming soon

This project's step-by-step walkthrough, with real outputs at every step, is still being written. You can read the brief and try it on your own meanwhile; tracking opens when the walkthrough is ready.

Done when

  • A table of accuracy, model size and latency for each version: full, mobile backbone, quantized.
  • The final model runs offline in under 300 ms per image on a budget phone.
  • Quantization loses less than 2 percentage points of accuracy, or you explain why it lost more.
  • A confusion matrix with the most-confused pairs explained.

Stretch goals

  • Test on your own photos taken outdoors and measure how much accuracy drops from the clean dataset.
  • Add an 'unsure, take another photo' answer when confidence is low.

Show it off