Projects / Plant Disease Detection

Plant Disease Detection

Building an end-to-end machine learning pipeline for agricultural disease detection, achieving production-grade accuracy and real-time inference.

Award 1st Place, Pi-515 State Challenge ($5,000)
Duration Jan 2025 – May 2025
Role ML Engineer, Full-Stack Developer
Team Web Developer (5-person team)
Python TensorFlow Computer Vision React Flask AWS

Problem & Context

Agricultural disease detection remains a challenge for farmers and agronomists. Early identification of crop diseases can reduce yield loss by up to 30%, but manual inspection is time-consuming and inconsistent.

The State of Iowa AI Innovation Challenge asked teams to build machine learning solutions addressing real-world problems. We identified plant disease detection as a high-impact opportunity combining cutting-edge ML with tangible agricultural value.

The Goal: Create a system that agricultural professionals could deploy in the field— a mobile-friendly interface backed by accurate, fast ML models capable of classifying diseases across multiple crop types.

Your Role & Responsibilities

ML Architecture & Training

Designed the neural network architecture, curated and preprocessed large-scale agricultural datasets, trained models with data augmentation strategies, and optimized for accuracy and inference speed.

Full-Stack Integration

Built a Flask backend API for model inference, developed a responsive React frontend for image upload and results display, and containerized the application for scalable deployment.

Production Deployment

Deployed the system on AWS with managed compute and storage, wrote monitoring and logging infrastructure, and ensured the system remained reliable under production load.

Competition & Presentation

Led the technical presentation to judges, articulated the ML methodology and business impact, and fielded questions on model interpretability and real-world deployment considerations.

System Architecture

The system is composed of three main layers: a robust ML pipeline, a Flask-based inference API, and a React frontend. This separation of concerns allows for independent scaling and updates.

Frontend Layer

React SPA

  • Image upload and preview
  • Real-time result display
  • Historical predictions
  • Mobile-responsive UI

API Layer

Flask REST API

  • Image preprocessing
  • Model inference
  • Result formatting
  • Monitoring & logging

ML Layer

TensorFlow Models

  • CNN for feature extraction
  • Transfer learning (ResNet50)
  • Multi-label classification
  • Confidence scoring

Key Technical Decisions

1. Transfer Learning with ResNet50

Rather than training from scratch, we leveraged ResNet50 pre-trained on ImageNet. This choice was strategic:

  • Efficiency: Reduced training time from weeks to days
  • Accuracy: Achieved higher accuracy with less data (only 10K images)
  • Generalization: Better performance on unseen disease types
  • Tradeoff: Less interpretability than custom architectures, but acceptable for a competition timeline

2. Data Augmentation Strategy

With limited training data, we applied aggressive augmentation:

  • Rotation: ±15 degrees (accounts for field photography angles)
  • Brightness/Contrast: ±20% (different lighting conditions)
  • Zoom: 0.8–1.2x (simulates proximity variation)
  • Result: Effective dataset size increased 5×, boosting accuracy by 4–6%

3. Multi-Crop Detection Over Single-Prediction

We initially implemented a single-crop classifier but pivoted to support multi-crop inputs. This decision addressed a real agronomic need:

  • Farmers often manage diverse crops simultaneously
  • A unified interface reduces friction
  • Slight latency increase (50–100ms) acceptable for production

4. Model Serving with TensorFlow Lite

For future mobile deployment, we optimized models for TensorFlow Lite:

  • Quantization: 4× smaller model size, minimal accuracy loss
  • Inference Latency: 50–100ms on CPU, suitable for on-device prediction
  • Future Proofing: Enables offline functionality without server dependency

Results & Impact

94.7%
Validation Accuracy

Across 12 disease classes and 4 crop types

78ms
Average Inference Time

On AWS CPU, per prediction

1st Place
Competition Award

Pi-515 State of Iowa Challenge, $5,000

3
Judges' Standout Notes

Production readiness, clear documentation, team communication

What Made This Win

The competition evaluated submissions on technical depth, real-world impact, and presentation quality. Our win came from:

  • Complete Pipeline: We didn't just submit a model—we delivered a production-ready system that judges could interact with and deploy
  • Clear Documentation: Every decision was justified with data and domain reasoning
  • Agricultural Domain Knowledge: We consulted ISU Extension resources to ensure our classification taxonomy matched real agronomic practices
  • Thoughtful Deployment: Demonstrated awareness of cost, latency, and farmer usability constraints

Lessons Learned

1. Domain Knowledge Informs Better ML

Talking to potential users (farmers, agronomists) revealed nuances we'd miss as engineers. We learned that classification confidence matters less than actionable recommendations. The final system now pairs predictions with agronomic guidance.

2. Deployment is Part of the Solution

A 99% accurate model locked in a research paper has no impact. We spent 20% of our effort on deployment and infrastructure. This visibility during judging was a decisive factor.

3. Clear Communication of Uncertainty Matters

Rather than masking model uncertainty, we surface confidence scores and recommend human review for borderline predictions. This builds trust and reflects real-world constraints.

4. Iterate Based on Real Feedback

Initial design had a complex classification hierarchy. Feedback from farm advisors led us to simplify the taxonomy and focus on common diseases first. Better accuracy, better UX.

Future Directions

While the project was a success, several opportunities remain:

  • Mobile App: Deploy on iOS/Android using TensorFlow Lite for offline functionality
  • Video Stream Processing: Extend to continuous field monitoring with real-time alerts
  • Active Learning: Implement feedback loops to refine models with new field data
  • Integration with Farm Management Systems: Connect to popular agricultural software platforms

Let's talk about this project

Interested in discussing the technical approach, competition experience, or future directions? I'd love to connect.