| --- |
| language: en |
| license: mit |
| tags: |
| - image-classification |
| - plant-disease |
| - agriculture |
| - efficientnet |
| - transfer-learning |
| - maize |
| - ghana |
| metrics: |
| - accuracy |
| - f1 |
| --- |
| |
| # Maize Disease & Pest Classifier — EfficientNet-B0 |
|
|
| Part of the MSc thesis: |
| **"Application of Deep Learning for Low-Resource Maize Disease Diagnosis |
| in Heterogeneous Agro-Ecological Zones"** |
|
|
| ## Model details |
|
|
| | | | |
| |---|---| |
| | Architecture | EfficientNet-B0 | |
| | Training strategy | Two-phase transfer learning (ImageNet → maize diseases) | |
| | Test accuracy | 90.94% | |
| | Weighted F1 | 0.9198 (validation) | |
| | Classes | 7 | |
| | Input size | 224 × 224 | |
|
|
| ## Classes |
|
|
| 0. Healthy |
| 1. Northern Leaf Blight |
| 2. Common Rust |
| 3. Gray Leaf Spot |
| 4. Ear Rot |
| 5. Fall Armyworm |
| 6. Stem Borer |
|
|
| ## Dataset |
|
|
| Combined from: |
| - **PlantVillage** (4,188 images, 4 classes) — [Kaggle](https://www.kaggle.com/datasets/abdallahalidev/plantvillage-dataset) |
| - **Ghana field images** (406 images, 3 classes) — custom field-collected dataset |
|
|
| Total: 4,594 images | Class imbalance: 10.75:1 |
|
|
| ## Usage |
|
|
| ```python |
| from huggingface_hub import hf_hub_download |
| import torch |
| from src.deployment.inference import MaizeClassifier |
| from PIL import Image |
| |
| ckpt = hf_hub_download(repo_id="moro23/maize-disease-model", |
| filename="best_val_weighted_f1_0.919762_epoch_22.pth") |
| classifier = MaizeClassifier(ckpt, "configs/data_config.yaml") |
| image = Image.open("maize_leaf.jpg") |
| print(classifier.predict(image)) |
| ``` |
|
|
| ## Deployment |
|
|
| Live demo: [HuggingFace Spaces](https://huggingface.co/spaces/moro23/maize-disease-diagnosis) |
|
|