cd /news/artificial-intelligence/healthycropping-offline-crop-disease… · home › topics › artificial-intelligence › article
[ARTICLE · art-155230] src=github.com ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

HealthyCropping – Offline crop disease diagnosis on Android (TFLite and RAG)

HealthyCropping, an open-source, non-commercial Android app published under the package name com.keylorpineda.healthycropping, runs quantized MobileNetV3 TFLite models on-device to diagnose coffee leaf rust, cacao frosty pod rot and banana black Sigatoka in under 50ms without a cellular connection, storing scans in SQLite and syncing to a FastAPI backend with a Gemini RAG advisory layer grounded in ICAFE, CATIE and CORBANA literature when connectivity returns. The project's docs/PLAN.md tracks 9 phases: Phases 1 through 5 (monorepo foundation, coffee model pipeline with INT8/FP16 export and verified 224x224 RGB parity, Expo React Native shell, edge inference and scanner, and cacao and banana specialist models) are completed, while Phase 6 (FastAPI and cloud sync) and Phase 7 (grounded Gemini RAG) are in progress. Phase 8 (low-end Android benchmarks and field daylight testing) and Phase 9 (signed APK distribution and a farmer pilot in Tarrazu, Costa Rica) are scheduled, and the app's disclaimer states it supports field decisions and does not replace a certified agronomist or phytosanitary laboratory.

read6 min views1 publishedOct 22, 2026
HealthyCropping – Offline crop disease diagnosis on Android (TFLite and RAG)
Image: Michielbdejong (auto-discovered)

Smallholder and medium-scale producers of coffee (Coffea arabica / canephora), cacao (Theobroma cacao), and banana (Musa spp.) in Central America frequently work in mountainous or rural plots with intermittent or zero cellular connectivity. Identifying pathogens early—such as coffee leaf rust (Hemileia vastatrix), cacao frosty pod rot (Moniliophthora roreri), or banana black Sigatoka (Pseudocercospora fijiensis)—is critical to timing cultural controls and preventing yield loss, yet cloud-only diagnostic tools fail in the field when connectivity drops.

HealthyCropping (com.keylorpineda.healthycropping) is an open-source, non-commercial, offline-first Android application. It runs quantized computer vision models directly on the phone with sub-50ms inference, records scans and plot geometries locally in SQLite, and synchronizes with a FastAPI backend and Gemini RAG advisory layer grounded in certified institutional literature (ICAFE, CATIE, CORBANA) once connectivity is restored.

Agronomic Disclaimer: HealthyCropping is a non-commercial, open-source decision-support tool designed initially for Costa Rica. It supports field decisions and does not replace a certified agronomist or phytosanitary laboratory. Always consult an agricultural professional before applying agrochemicals or removing plants.

The project is structured into 9 execution phases according to docs/PLAN.md:

Phase Milestone Scope Status
Phase 1 Foundation & Governance Monorepo layout, strict linting ( ruff ,mypy , ESLint), CI quality gates Completed
Phase 2 Coffee Model Pipeline MobileNetV3 TFLite, INT8/FP16 export, verified 224x224 RGB parity Completed
Phase 3 Core Mobile Shell Expo React Native, SQLite schema, agricultural design system, Spanish UI Completed
Phase 4 Edge Inference & Scanner On-device TFLite camera, reticle framing, confidence thresholding, triage Completed
Phase 5 Multi-Crop Expansion Cacao pod and banana leaf specialist models, multi-crop app routing Completed
Phase 6 FastAPI & Cloud Sync Farm/plot sync endpoints, Firebase Admin auth, Cloudinary image ingestion In Progress
Phase 7 Grounded Gemini RAG Institutional agronomy corpus, citation retrieval, safe treatment advice In Progress
Phase 8 Performance & Hardening Low-end Android hardware benchmarks, field daylight testing Scheduled
Phase 9 Field Validation & Release Signed APK distribution, farmer pilot in Tarrazu, Costa Rica Scheduled
flowchart LR
    A["1. Select Crop\n(Coffee / Cacao / Banana)"] --> B["2. Capture Photo\n(Guided framing tips)"]
    B --> C["3. On-Device Preprocessing\n(224x224 RGB + normalize)"]
    C --> D["4. Offline TFLite Inference\n(MobileNetV3 float16 / INT8)"]
    D --> E["5. Instant Local Result\n(Class, Severity, SQLite)"]
    E -. "Optional when online" .-> F["6. Cloud Sync & Gemini RAG\n(FastAPI + Cited Manuals)"]
  1. Crop Selection : The user selectsCoffee (leaf underside),Cacao (pod), orBanana (leaf) prior to scanning so a dedicated specialist model runs for that crop.
  2. Offline On-Device Inference : The captured photo is resized to224x224 , decoded to raw RGB, normalized with exact training statistics, and evaluated locally in< 50ms usingreact-native-fast-tflite .
  3. Actionable Triage & Thresholding : If confidence falls below the calibrated validation threshold, the app instructs the user to retake the photo. Otherwise, it reports predicted class, severity level, confidence, and recommended triage action (healthy ,watch , oract now ).
  4. Local Persistence & Optional Sync : Scans, farms, and plots are stored locally inexpo-sqlite with client-generated UUIDs. Account creation is optional and used solely to synchronize records idempotently through the FastAPI backend (api/ ).
  5. Grounded RAG Advisory : When online, the backend retrieves passages from official technical manuals (ICAFE for coffee, CATIE for cacao, CORBANA for banana) and utilizes Gemini to summarize recommendations without hallucinated chemical remedies.

One fine-tuned MobileNetV3 model is trained, evaluated, and exported per crop (224x224 RGB input, quantized TFLite < 10 MB):

Crop Target Organ Target Classes Evaluation Metric Export Format Documentation
Coffee Leaf (underside) healthy ,leaf_rust (+ severity),leaf_miner ,cercospora ,brown_leaf_spot ,red_spider_mite > 90% Macro-F1 FP16 / INT8 TFLite Model Card
Cacao Pod healthy ,monilia (by stage),black_pod (Phytophthora ) > 92% Macro-F1 FP16 / INT8 TFLite Model Card
Banana Leaf healthy ,black_sigatoka ,fusarium_wilt ,cordana > 92% Macro-F1 FP16 / INT8 TFLite Model Card

Tensor preprocessing parity between Python (ml/) and React Native ( app/src/ml/) is enforced by shared fixture tests.

healthycropping/
├── app/       # Expo React Native (Android, pnpm): on-device TFLite, SQLite, UI
├── api/       # Python 3.12 (uv): FastAPI, Firebase Admin, Cloudinary, RAG
├── ml/        # Python 3.12 (uv): data preprocessing, training, eval, TFLite export
└── docs/      # ARCHITECTURE, PLAN, MODEL_CARD, DATASETS, EXPERIMENTS, DEVLOG
Workspace Stack Purpose
app/ React Native 0.76, Expo 52, TypeScript, SQLite, TFLite Offline mobile application for Android
api/ Python 3.12, FastAPI, Firebase Admin, Cloudinary, Gemini Sync endpoints, token verification & RAG advisory
ml/ Python 3.12, TensorFlow 2.16, TFLite, Pillow Training pipelines, evaluation & quantized edge export
  • Mobile : Node.js 20+,pnpm (configured withnode-linker=hoisted ), Android SDK.
  • Backend & ML : Python 3.12,uv package manager.
cd app
pnpm install
pnpm typecheck
pnpm lint
pnpm test
pnpm start
cd api
uv sync --all-extras
uv run ruff check .
uv run mypy src tests
uv run pytest
uv run uvicorn src.main:app --reload
cd ml
uv sync --all-extras
uv run ruff check .
uv run mypy src scripts tests
uv run pytest

Contributions are welcome. Please check our open issues and guidelines before opening a pull request:

  1. Decision Support Only : Visual symptoms cannot distinguish every microscopic pathogen strain or nutrient deficiency. Laboratory diagnostics remain necessary for high-impact interventions.
  2. Field Lighting Sensitivity : Direct specular glare on wet foliage or extreme motion blur can reduce model confidence.
  3. Backend Cold Starts : The optional FastAPI synchronization API runs on Render's free tier (sleeps after 15 minutes of inactivity). Core disease diagnosis and SQLite storage operate 100% offline on the phone and are never affected.

The MIT license in LICENSE applies solely to the source code in this repository. Training datasets remain under their respective upstream licenses documented in docs/DATASETS.md:

HealthyCropping (com.keylorpineda.healthycropping) is strictly non-commercial. It is distributed free of charge as an installable Android .apk exclusively through GitHub Releases, with no advertisements or paid subscriptions.

@software{pineda2026healthycropping,
  author       = {Pineda, Keylor},
  title        = {{HealthyCropping: Offline-First Crop Disease Detection for Coffee, Cacao, and Banana}},
  year         = {2026},
  url          = {https://github.com/keylorpineda/healthycropping},
  version      = {0.1.0},
  license      = {MIT}
}
── more in #artificial-intelligence 4 stories · sorted by recency
── more on @healthycropping 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/healthycropping-offl…] indexed:0 read:6min 2026-10-22 · —