Collect and label images
Gather diverse, licensed photos of affected and healthy leaves, label by disease type and hold out geographic splits for evaluation.
Detect plant disease on-device. Weigh latency against accuracy.
On-device plant disease detection aims to classify leaf or crop images under tight latency and memory constraints. Real builds must handle variable lighting, multiple species, background clutter and provide a review path for potentially harmful recommendations.
Learning concept · Not a validated service
On-device plant disease detection aims to classify leaf or crop images under tight latency and memory constraints. Real builds must handle variable lighting, multiple species, background clutter and provide a review path for potentially harmful recommendations.
A proposed application: a phone app that flags likely diseased leaves for a farmer and uploads uncertain examples for agronomist review. The supplied starter code does not deliver this app; it only demonstrates a small CPU inference benchmark with synthetic data.
Gather diverse, licensed photos of affected and healthy leaves, label by disease type and hold out geographic splits for evaluation.
Train a small CNN or MobileNet variant on the training set and tune for accuracy, parameter count and latency.
Convert the trained model to TensorFlow Lite or ONNX and measure single-sample latency, memory and battery impact on target devices.
Route low-confidence predictions to agronomists and instrument corrections to retrain and monitor drift.
The supplied starter generates synthetic tabular data with sklearn.make_classification, fits a DecisionTreeClassifier, then measures an estimated per-sample prediction latency by calling model.predict(sample) in a tight loop and prints latency, tree depth and node count. It does not load or process plant images, nor convert a model for mobile runtime.
X, y = make_classification(n_samples=1000, n_features=12, n_informative=8, random_state=42)
model = DecisionTreeClassifier(max_depth=6, random_state=42)
model.fit(X, y)
sample = X[:1]
start = time.perf_counter()
for _ in range(1000):
model.predict(sample)
latency_ms = (time.perf_counter() - start) * 1000 / 1000The code uses synthetic numeric features rather than plant images or sensor telemetry, so it does not validate image-based disease detection. It trains a scikit-learn decision tree rather than a mobile CNN and does not perform TFLite/ONNX conversion, camera capture, data augmentation or real device profiling. The latency estimate is a micro-benchmark on repeated in-process predictions and does not reflect end-to-end mobile latency, I/O, or power use.
A proposed extension is to replace the synthetic data with a labelled leaf image set, train a small CNN (or MobileNetV2), quantise and export to TensorFlow Lite, and build a simple app that captures images, runs local inference and flags uncertain cases for agronomist review.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its Network Engineering Course, with placement support and hands-on labs.