Edge AI / Computer vision
DoctorMaiz
An offline maize disease classifier for small-scale farmers: a 3.56 MB int8 model that diagnoses 9 diseases, pests and nutrient deficiencies in ~60 ms on an Android phone, with no connection.
- Context
- Machine Learning specialization project
- Year
- 2025
- Result
- 0.947macro-F1 · 3.56 MB · ~60 ms offline on Android
- Links
- Dataset
DoctorMaiz is an edge-AI system that identifies maize leaf diseases, pests and nutrient deficiencies from a single photo, fully offline on Android. It is built for small-scale farmers in rural areas without connectivity, where a late diagnosis can cost a large part of a harvest.
I led the machine learning side: data, training, evaluation, interpretability and export. The corpus consolidates 33,438 images from 8 public sources, deduplicated with perceptual hashing. A classic stratified split leaks images from the same source to both sides and inflates metrics, so I audited that leakage, built source-grouped splits and measured generalization with leave-one-source-out evaluation. That honest number (0.60 macro-F1 on unseen sources versus 0.95 in-domain) is reported next to the headline result, because it is what a farmer with a new camera and a new field actually gets.
The deployed model is EfficientNet-Lite0 quantized to int8 TensorFlow Lite: 0.947 macro-F1 and 97.9% accuracy on an independent test set of 5,015 images, 3.56 MB on disk and around 60 ms per image on a mid-range phone. Training uses PyTorch with Optuna for hyperparameter search, K-fold cross-validation and a soft-voting ensemble (0.957 macro-F1) for server-side inference. The export pipeline checks numerical parity between PyTorch, ONNX and TFLite, and the model exposes its pooled features so the app can run a Mahalanobis out-of-distribution detector that rejects photos that are not maize leaves.
A fairness audit compares lab and field images, and a small FastAPI backend handles accounts, optional sync and dataset contributions. Training runs on GPUs through Modal.