Tomato Doctor: An AI Advisory System for tomato leaf disease detection and retrieval-augmented agronomic guidance for smallholder tomato production

dc.contributor.authorNewton Anguyi
dc.contributor.authorTimothy Opifudrira
dc.date.accessioned2026-08-17T12:29:25Z
dc.date.available2026-08-17T12:29:25Z
dc.date.issued2026-06-11
dc.descriptionUndergraduate
dc.description.abstractSmallholder tomato farmers require timely, practical, and localized guidance for tomato crop management decisions, yet many lack fast access to expert support when Tomato Early Blight (Alternaria solani) or Tomato Late Blight (Phytophthora infestans) symptoms first appear on Solanum lycopersicum. In this project, we built a full-stack Smart AI Advisory System for Smallholder Farmers, delivered to end users as the Tomato Doctor mobile application. The prototype integrates three tightly-coupled capabilities into a single workflow: (1) AI-based tomato leaf disease diagnosis from images, (2) a contextual advisory chatbot that turns a tomato diagnosis into actionable management guidance, and (3) optional field-feedback capture to support future dataset improvement and retraining. The system is intentionally narrowed to three classes only: Tomato Early Blight, Tomato Late Blight, and Healthy (Tomato Leaf). The disease diagnosis pipeline is implemented with transfer learning using MobileNetV2 [1], trained on a 3-class subset of PlantVillage [2] and then fine-tuned using field images to improve real-world robustness. The primary deployed model is the field fine-tuned checkpoint mobilenetv2_field_3class_fieldda ta.pth. Inference includes uncertainty gating to handle images that are not tomato leaves or are unclear; instead of forcing a wrong class, the API returns an “unsupported/unclear” response. Robustness is further improved by lightweight test-time augmentation (original + horizontal flip) and careful image preprocessing that preserves aspect ratio and corrects EXIF orientation. Explainability (Grad-CAM) [3] is generated for Early Blight and Late Blight predictions only, and severity estimation (lesion coverage %, lesion count, and severity stage) is applied to Early Blight detections to support urgency-aware recommendations. The advisory feature is implemented as an authenticated Django REST API that combines a retrieval-augmented generation (RAG) pipeline (sentence-transformers [4] with ChromaDB [5]), disease-context prompting using optional fields disease_name and detection_context, and a rule-based fallback for greetings and very short messages. Field evaluation on 89 held-out real photos shows the impact of fine-tuning: the base model achieved approximately 28% accuracy on field images, while the fine-tuned 3-class model achieved 85.4% accuracy with balanced precision/recall. The final outcome is a v1.0 proof-of-concept that integrates tomato foliar disease detection (Early Blight, Late Blight, Healthy), explainability, and grounded advisory guidance in a single mobile-first workflow, with clear limitations for real-world use.
dc.identifier.urihttps://hdl.handle.net/20.500.12311/3535
dc.language.isoen
dc.publisherUganda Christian University
dc.titleTomato Doctor: An AI Advisory System for tomato leaf disease detection and retrieval-augmented agronomic guidance for smallholder tomato production
dc.typeProject Report

Files

Original bundle
Now showing 1 - 1 of 1
No Thumbnail Available
Name:
Tomato Doctor_BSIT_2026.pdf
Size:
9.58 MB
Format:
Adobe Portable Document Format
License bundle
Now showing 1 - 1 of 1
No Thumbnail Available
Name:
license.txt
Size:
1.71 KB
Format:
Item-specific license agreed upon to submission
Description: