CAPSTONE-LAZARUS is a robust, production-ready computer vision system that detects plant diseases from leaf images using deep learning. Designed for farmers, agronomists, and agricultural support systems to enable quick diagnosis and corrective action.
✅ Python 3.11+ Compatibility with pinned dependencies
✅ Defensive Programming throughout data pipeline
✅ Deterministic Training with reproducible seeds
✅ Comprehensive Testing with CI/CD pipeline
✅ Clean EDA Notebook replacing corrupted version
✅ Robust Model Loading with proper error handling
✅ Environment Validation scripts for quick setup verification
# Validate environment setup
python scripts/validate_environment.py
# Test data loader functionality
python scripts/validate_loader.py
# Test inference functions
python scripts/validate_inference.py
# Run smoke tests
python tests/test_data_utils.py- Robust multi-class classification across 19 plant disease classes
- High recall on critical diseases (>90%) to minimize false negatives
- Interpretable predictions with confidence scores and Grad-CAM visualizations
- Lightweight deployment for mobile/edge devices
- Interactive dashboard with Plotly visualizations
26,134 RGB leaf images across 19 disease classes:
- Healthy
- Cercospora leaf spot / Gray leaf spot
- Common rust
- Northern Leaf Blight (+ oversampled/undersampled variants)
- Healthy
- Early blight
- Late blight
- Healthy
- Bacterial spot
- Early blight
- Late blight
- Leaf Mold
- Septoria leaf spot
- Spider mites Two-spotted spider mite
- Target Spot
- Tomato mosaic virus
- Tomato Yellow Leaf Curl Virus
📂 Capstone-Lazarus/
├── 📊 data/ # 26K+ plant disease images
├── 📓 notebooks/ # Jupyter notebooks for EDA & training
│ ├── eda_plant_diseases.ipynb # Comprehensive data exploration
│ └── model_training.ipynb # Model training & evaluation
├── 🧠 models/ # Saved trained models
├── 📱 app/ # Streamlit dashboard
│ └── streamlit_app.py
├── 🔧 src/ # Core ML modules
│ ├── data_utils.py # Data loading & preprocessing
│ ├── model_factory.py # Model architectures
│ ├── training.py # Training pipeline
│ └── inference.py # Prediction & explanation
└── 📋 requirements.txt # Dependencies# 1. Install dependencies
pip install -r requirements.txt
# 2. Validate environment
python scripts/validate_environment.py
# 3. Explore data
jupyter notebook notebooks/eda_plant_diseases.ipynb
# 4. Train models (see Local Training & Dashboard below)
jupyter notebook notebooks/master_model_trainer.ipynb
# 5. Launch dashboard
streamlit run app/lazarus_console/__init__.pyOption 1: Jupyter Notebook (Recommended)
# Full training run
jupyter notebook notebooks/master_model_trainer.ipynb
# Or convert and execute directly
jupyter nbconvert --execute notebooks/master_model_trainer.ipynbOption 2: Python CLI
# Fast smoke test (1 epoch, small sample)
python -m src.master_trainer --fast-test
# Full training from config
python -m src.master_trainer --config config.yamlFor Low-Spec Machines (HP ZBook 15 G5, 16GB RAM):
Recommended settings in notebook or config.yaml:
batch_size: 2-4(instead of 8)image_size: 160(instead of 224)fast_test: truefor initial runs- Train one model at a time
# Primary method
streamlit run app/lazarus_console/__init__.py
# Or use convenience wrapper
python run.pyDashboard Features:
- 🏠 Mission Readiness: Latest metrics, checkpoints feed
- 🔬 Inference Lab: Batch upload, ensemble mode, confidence thresholds
- 🧬 Explainability Studio: Grad-CAM with opacity control
- 📊 Model Comparison: Side-by-side metrics, confusion matrices
# Smoke test suite (PowerShell on Windows)
.\run_smoke_tests.ps1
# Or Bash (Linux/macOS/Git Bash)
./run_smoke_tests.sh
# Individual test files
pytest tests/test_smoke_train.py -v
pytest tests/test_streamlit_integration.py -v
pytest tests/test_master_trainer.py -v# CPU profiling
python scripts/profile_inference.py \
--model models/{run_id}/best.pth \
--device cpu \
--runs 100
# GPU profiling (if CUDA available)
python scripts/profile_inference.py \
--model models/{run_id}/best.pth \
--device cuda \
--batch-size 8For detailed troubleshooting, see docs/runbook.md.
- Macro F1 Score: ≥ 0.85
- Critical Disease Recall: ≥ 90%
- Model Size: ≤ 50MB
- Inference Time: ≤ 500ms
- Transfer Learning with EfficientNet, ResNet, MobileNet
- Advanced Data Augmentation for field conditions
- Class-weighted Loss for imbalanced datasets
- Grad-CAM Explanations for model interpretability
- Uncertainty Estimation with Monte Carlo Dropout
- Interactive Dashboard with Plotly visualizations
- Early disease detection → reduced crop losses
- Precision agriculture → optimized treatment
- Farmer empowerment → AI-assisted decisions
- Sustainable farming → reduced pesticide usage