# 🌽 Maize Leaf Disease Detection — CNN & VGG16
An interactive **Streamlit** web app that classifies maize (corn) leaf diseases
from an uploaded photo using two deep-learning models: a **custom CNN** and
**VGG16 transfer learning**. It shows the raw image, the preprocessing pipeline,
the predicted disease with a reference leaf image, and full evaluation
visualisations — accuracy curves, **ROC plot**, **confusion matrix** and
**classification report** — in a professional purple theme with Cambria
typography.
**Classes:** `Blight` (Northern Leaf Blight) · `Common_Rust` ·
`Gray_Leaf_Spot` · `Healthy`
---
## 1. Project structure
```
maize-disease-detection/
├── app.py # Streamlit web app (purple theme + Cambria)
├── train.py # Train custom CNN and VGG16
├── evaluate.py # ROC, confusion matrix, classification report
├── utils.py # Config + preprocessing helpers
├── requirements.txt
├── Dockerfile # For Cloud Run
├── .dockerignore
├── .streamlit/config.toml # Base theme
├── models/ # Saved models (created by train.py)
├── artifacts/ # Eval JSON read by the app (created by evaluate.py)
└── Dataset/ # You download this (one folder per class)
```
---
## 2. Get the dataset
Download from either source and unzip so the folders look like
`Dataset/ /*.jpg`:
- Kaggle:
- GitHub:
```bash
# Kaggle CLI option
pip install kaggle
kaggle datasets download -d smaranjitghose/corn-or-maize-leaf-disease-dataset
unzip corn-or-maize-leaf-disease-dataset.zip -d Dataset
```
> Make sure the four sub-folders are named exactly
> `Blight`, `Common_Rust`, `Gray_Leaf_Spot`, `Healthy`
> (rename if the download uses spaces). This matches `CLASS_NAMES` in `utils.py`.
---
## 3. Set up and run locally
```bash
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python train.py --model both --epochs 20 # trains CNN + V …