Real-Time Weed Detection
Edge Computer Vision for Smallholder Farmers
Problem
Invasive plant species cost smallholder farmers billions annually. Identification requires expert knowledge unavailable in the field, especially without internet.
Solution
MobileNetV2 with Transfer Learning on PlantCLEF dataset. TFLite post-training quantization for 4x model compression. Runs fully on-device.
Result
Sub-second inference on mid-range Android. Under 50MB memory budget. No internet required. Accessible to any farmer with a smartphone.
Impact
- ✦Sub-second inference on mobile hardware
- ✦Runs entirely on-device | no internet required
- ✦High accuracy on localized PlantCLEF dataset subset
- ✦Designed for farmers with no technical background
01The Problem
Invasive plant species cost smallholder farmers in developing regions billions annually in crop losses. Identifying harmful weeds early requires either expensive specialist knowledge or lab testing | neither of which is accessible to farmers working with thin margins. The goal was to build a tool that could identify invasive plants in real-time, using only a mobile phone, with no internet connection required.
02The Constraints
Mobile hardware constraints were severe | the model had to run on CPU only, with no GPU acceleration. Memory budget was under 50MB. Inference had to be under one second to feel usable in the field. The model also had to be robust to varying lighting conditions, camera angles, and partial occlusion | real-world agricultural environments are far messier than benchmark datasets.
03Technical Approach
I chose MobileNetV2 as the base architecture for its efficiency-accuracy tradeoff, applying Transfer Learning on a localized subset of the PlantCLEF dataset. The training pipeline used aggressive data augmentation | random crops, flips, brightness variation, and simulated blur | to improve robustness to field conditions. Post-training quantization via TensorFlow Lite reduced the model size by 4x with minimal accuracy loss. I also exported to ONNX for cross-platform compatibility. The full preprocessing and augmentation pipeline was built in Jupyter with reproducible random seeds and documented data provenance.
04Key Decisions
The decision to use TFLite over CoreML or ONNX Runtime was driven by Android's broader reach in target markets. MobileNetV2 over EfficientNet-Lite was a latency decision | EfficientNet was marginally more accurate but 40% slower on test hardware. Choosing Transfer Learning over training from scratch was non-negotiable | the dataset was too small for a full training run, and the ImageNet features transferred exceptionally well to plant classification.
05Outcome
The final model runs at sub-second inference on mid-range Android hardware, fits within the memory budget, and achieves strong accuracy on the localized dataset. The on-device architecture means farmers in areas with no mobile data connectivity can use it fully. The project directly embodies my belief in democratizing AI | transforming complex botanical knowledge into a tool accessible to anyone with a smartphone.