Skip to content
← All work

KNUST final-year project · 2025 – 2026Shipped

CropScan

CropScan diagnoses tomato, maize and pepper leaf diseases from one photo, entirely on the phone. My project partner Nana Ekow Bryan and I built it for our final year. I wrote the training notebook and built the Flutter app and the on-device inference around the model.

Who wrote whatA final-year project with my partner, Nana Ekow Bryan, who ran the training on his machine. I wrote the Keras training notebook, the TensorFlow Lite conversion, the Flutter app and the on-device inference service. In October 2026 I used Claude to restructure the app into features, sharpen the diagnosis flow, and add the care plan, the weather warning, a crop guide built from real data and a design system, with a test suite. I reviewed and merged that work as six pull requests.

CropScan running on a phone, showing the My Crops screen, next to a laptop with the code
CropScan running on my phone, next to the code.
From training to the phone
  1. 25,802 PlantVillage leaves + 2,000 “not a crop” images
  2. Keras CNN, 256×256, trained from scratch
  3. TensorFlow Lite, ≈745 KB
  4. Flutter app, inference in a background isolate
  5. Diagnosis, care plan, local history

Open-Meteo weather adds a regional disease-risk warning only when there is signal.

Why offline

A farmer standing in a field with a sick plant usually doesn't have a reliable connection. My first prototype sent the photo to a FastAPI server running TensorFlow Serving. It worked on my laptop and nowhere else that mattered, so the final model runs on the phone.

The model

A small convolutional network in Keras, about six convolution and pooling blocks, trained from scratch at 256×256 on 25,802 PlantVillage leaf images across 16 classes: maize (4), bell pepper (2) and tomato (10). The best checkpoint, at epoch 42, reached 98.36% on the validation set, and the model scored 98.13% on the held-out test split.

I then added 2,000 everyday photos (people, sky, soil, vehicles) as a 17th “not a crop” class, so a picture of a wall doesn't come back as late blight. That is the model the app ships. The converted TensorFlow Lite file is about 745 KB, small enough to ship inside the app with no download.

What 98% does and doesn't mean

PlantVillage photos are single leaves on plain backgrounds under even light. Models trained on it learn shortcuts: one study got about 49% accuracy on PlantVillage from background pixels alone, with no leaf in the picture. So 98.13% tells you how well the model learned the dataset, not how it will do on a farm near Kumasi at four in the afternoon.

I also found a few things in our own pipeline that I'd now do differently: the validation and test numbers come from a random split, which can put near-duplicate photos of the same leaf on both sides; the conversion applies no quantization; and the app's confidence thresholds (0.75 for a confident result, 0.40 below which it says “not a crop”) are applied to raw softmax scores, which are not calibrated probabilities. A farmer reads a confidence number as a promise, so it should mean something.

The app

The camera or gallery feeds a 256×256 image to the model in a background isolate, so the preview doesn't stutter. The result is graded: confident, uncertain (shown with a warning and the next most likely diagnoses), or not a crop. A diagnosis opens treatment advice and a follow-up care plan, and every scan is saved to local history. When there is signal, the app also shows a disease-risk warning for the farmer's region using Open-Meteo weather.

Next

Measure the lab-to-field gap properly: evaluate on field photos (the Ghana-collected CCMT dataset and PlantDoc), add a pretrained MobileNetV3 baseline and int8 quantization, publish a per-class confusion matrix, and time inference on a cheap Android phone of the kind farmers actually buy.

The treatment advice also needs checking by an agronomist against Ghana's registered pesticide list before anyone should act on it.

NextReporting automation in a bank→

07 · Contact

Write to me.

I'm open to software engineering and data roles, and to freelance work. If you have a process that still runs on copy and paste, I'd like to hear about it.