
Project Overview
Coffee Disease Detection is an advanced computer vision system designed to identify diseases in coffee plants from leaf images. Originally presented as a winning idea for Le Wagon’s Data Science & AI bootcamp, this project was selected as one of two final projects to be developed by a team of four students.
As project leader, I coordinated the development team and guided the creation of a comprehensive solution that can detect five different classes: healthy leaves and four common diseases (Cercospora, Leaf Rust, Miner, and Phoma) that significantly impact coffee crop yields.
Key Features
🧠 Multiple Model Architectures
- VGG16 Transfer Learning - Stable performance with anti-overfitting measures
- EfficientNetB0 - Optimized for accuracy and efficiency
- Custom CNN - Lightweight model for smaller datasets
- Automatic architecture detection and model loading
🎯 Disease-Focused Optimization
- Custom class weighting prioritizing disease detection
- Disease-specific recall metrics to minimize false negatives
- False negative analysis tools for model improvement
- Balanced training with adaptive learning rates
🚀 Production-Ready Deployment
- FastAPI backend with comprehensive API documentation
- Streamlit web application for easy image upload and prediction
- Google Cloud deployment with Dockerized API for scalable inference
- MLflow integration for experiment tracking and model versioning
- Modular Python package structure for maintainable codebase
Technical Architecture
Model Training Pipeline
- Multi-phase training with initial feature extraction and fine-tuning
- Custom callbacks for disease recall monitoring
- Adaptive learning rates based on dataset size
- Comprehensive evaluation with confusion matrices and detailed metrics
Data Processing
- Smart data augmentation preserving disease characteristics
- Letterboxing preprocessing to 224x224 resolution
- Automatic train/validation/test splitting
- Class distribution analysis and balancing
API and Deployment
- RESTful API with image upload and prediction endpoints
- Base64 and file upload support for flexible integration
- Comprehensive error handling and validation
- Production caching system for model loading optimization
- Google Cloud Platform deployment for scalable cloud-based inference
- Separate web frontend repository available at https://github.com/fermx3/coffeedd-web for the Streamlit application
Project Leadership & Team Coordination
Team Management
- Led a four-person development team through the complete project lifecycle
- Coordinated tasks and timelines ensuring timely delivery of milestones
- Applied software engineering best practices including version control and documentation
- Maintained comprehensive GitHub repository with clear structure and technical documentation
Le Wagon Bootcamp Achievement
- Winning project selection from multiple proposed ideas in Le Wagon’s Data Science & AI bootcamp
- One of two final projects chosen for development by the class
- End-to-end project delivery from initial concept to production deployment
Disease Classification
The system detects these coffee plant conditions:
- Healthy - Normal, disease-free coffee leaves
- Cercospora - Fungal disease causing brown leaf spots
- Leaf Rust - Orange/yellow pustules on leaf undersides
- Miner - Insect damage creating tunnels in leaves
- Phoma - Fungal disease causing leaf blight
Technical Highlights
Smart Class Weighting
Custom weighting system that penalizes healthy misclassification while boosting rare disease detection:
- Healthy leaves: Reduced weight to prevent false negatives
- Rare diseases: Increased weight for better detection
- Adaptive weighting: Based on dataset size and distribution
Advanced Metrics
- Disease Recall Metric: Custom TensorFlow metric focusing on disease detection
- Binary classification analysis: Healthy vs. any disease performance
- Detailed confusion matrices with class-specific insights
- False negative analysis for continuous improvement
Model Management
- MLflow tracking for experiment management
- Automatic model registry with versioning
- Production model deployment with A/B testing capability
- Model architecture detection for seamless loading
Impact and Applications
- ✅ Early disease detection enabling timely treatment
- ✅ Reduced crop losses through accurate identification
- ✅ Farmer accessibility via simple web interface
- ✅ Scalable deployment for agricultural organizations
- ✅ Research foundation for agricultural AI development
The system represents a significant advancement in precision agriculture, providing coffee farmers with AI-powered tools to protect their crops and optimize yields through early disease detection.
Project Details
Objective
Build an accurate and reliable system to help coffee farmers identify plant diseases early, enabling timely treatment and crop protection.
Theme
Agricultural AI with focus on precision farming and disease prevention.
Date
November 15, 2025