# Crop Disease Detection – Kaggle Competition (Uganda Dataset)
This project develops an image classification model using PyTorch to identify crop diseases from leaf images. It was built for the Kaggle competition: Cassava Leaf Disease Classification, and incorporates ensembling, cross-validation, and deployment via a Streamlit web app.
## Table of Contents
1. Project Overview
2. Project Structure
3. Data Preparation
- Dataset Overview
- Handling Imbalanced Data
4. Model Training
- Cross-Validation Strategy (K-Fold)
- Model Architecture
- Callbacks and Training Enhancements
5. Model Evaluation
6. Model Ensembling
7. Deployment
- Streamlit Web App
8. How to Run
9. Results Summary
---
## Project Overview
This project aims to build a robust crop disease classifier using PyTorch. It tackles class imbalance, leverages K-Fold cross-validation, and ensembles the final predictions for enhanced accuracy. A Streamlit app is also built for easy interaction and real-time prediction.
---
## Project Structure
```
├── notebooks/ # EDA and model training notebooks
├── src/
│ ├── utils/ # Helper functions (data loading, training, etc.)
├── model/ # Trained model checkpoints
│ ├── fold_0/ # Model for Fold 0
│ ├── fold_1/ # Model for Fold 1
│ └── ... # etc.
├── app/ # Streamlit web app code
```
---
## Data Preparation
### Dataset Overview
The dataset includes images of diseased and healthy leaves of cassava crops. The labels represent different disease types.
- 📂 **Dataset link**: Cassava Plant Disease – Merged 2019/2020
- 🏆 **Competition link**: Cassava Leaf Disease Classification
### Handling Imbalanced Data
The dataset was significantly imbalanced. To address this:
- **Under-sampling** of majority classes was applied to ensure fair training across folds.
---
## Model Training
### Cross-Validation Strategy (K-Fold)
To ensure model generalization and robustness, a 5-fold **Str …