Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,117 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- crop-disease-detection
|
| 5 |
+
- computer-vision
|
| 6 |
+
- pytorch
|
| 7 |
+
- efficientnet
|
| 8 |
+
- agriculture
|
| 9 |
+
- plant-diseases
|
| 10 |
+
datasets:
|
| 11 |
+
- plant-village
|
| 12 |
+
- dhan-shomadhan
|
| 13 |
+
- custom
|
| 14 |
+
language: en
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Crop Disease Detection Model (EfficientNet-B3)
|
| 18 |
+
|
| 19 |
+
## Overview
|
| 20 |
+
|
| 21 |
+
This model detects and classifies crop diseases using computer vision and deep learning. Built on **EfficientNet-B3** and trained on a curated dataset of 13,000+ images, the model can recognize 17 disease classes across **five major crops**:
|
| 22 |
+
|
| 23 |
+
- **Corn** (Common Rust, Gray Leaf Spot, Northern Leaf Blight, Healthy)
|
| 24 |
+
- **Potato** (Early Blight, Late Blight, Healthy)
|
| 25 |
+
- **Rice** (Brown Spot, Leaf Blast, Neck Blast, Healthy)
|
| 26 |
+
- **Wheat** (Yellow Rust, Brown Rust, Healthy)
|
| 27 |
+
- **Sugarcane** (Red Rot, Bacterial Blight, Healthy)
|
| 28 |
+
|
| 29 |
+
✅ **Accuracy:** 94.8%
|
| 30 |
+
✅ **Precision:** 95.4%
|
| 31 |
+
✅ **Recall:** 94.5%
|
| 32 |
+
|
| 33 |
+
The model contributes to **SDG 2 – Zero Hunger**, **SDG 12 – Responsible Consumption**, and **SDG 13 – Climate Action** by enabling early intervention and sustainable agriculture practices.
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## Model Details
|
| 38 |
+
|
| 39 |
+
- **Architecture**: EfficientNet-B3 (pretrained on ImageNet)
|
| 40 |
+
- **Classifier Head**: Replaced with `Linear(1536 → 17)`
|
| 41 |
+
- **Framework**: PyTorch
|
| 42 |
+
- **Total Parameters**: ~10.7M
|
| 43 |
+
- **Training**:
|
| 44 |
+
- 5-fold cross-validation
|
| 45 |
+
- Early stopping (best at epoch 29)
|
| 46 |
+
- Augmentation & normalization
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## How to Use
|
| 51 |
+
|
| 52 |
+
> 💡 This model requires preprocessing consistent with training (image resizing, normalization). For ready-to-use prediction.
|
| 53 |
+
|
| 54 |
+
### Inference Example (PyTorch)
|
| 55 |
+
```python
|
| 56 |
+
import torch
|
| 57 |
+
from torchvision import transforms
|
| 58 |
+
from PIL import Image
|
| 59 |
+
import requests
|
| 60 |
+
from huggingface_hub import hf_hub_download
|
| 61 |
+
|
| 62 |
+
# Download the model file from Hugging Face
|
| 63 |
+
model_path = hf_hub_download(repo_id="VisionaryQuant/5_Crop_Disease_Detection", filename="efficientnet_b3_model.pt")
|
| 64 |
+
|
| 65 |
+
# Load the model (make sure your architecture matches)
|
| 66 |
+
model = torch.load(model_path, map_location=torch.device('cpu'))
|
| 67 |
+
model.eval()
|
| 68 |
+
|
| 69 |
+
# Preprocess input image
|
| 70 |
+
image = Image.open("your_crop_image.jpg").convert("RGB")
|
| 71 |
+
transform = transforms.Compose([
|
| 72 |
+
transforms.Resize((300, 300)),
|
| 73 |
+
transforms.ToTensor(),
|
| 74 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406],
|
| 75 |
+
std=[0.229, 0.224, 0.225])
|
| 76 |
+
])
|
| 77 |
+
input_tensor = transform(image).unsqueeze(0)
|
| 78 |
+
|
| 79 |
+
# Run inference
|
| 80 |
+
with torch.no_grad():
|
| 81 |
+
logits = model(input_tensor)
|
| 82 |
+
probs = torch.nn.functional.softmax(logits, dim=1)
|
| 83 |
+
predicted_idx = torch.argmax(probs, dim=1).item()
|
| 84 |
+
|
| 85 |
+
# Map class index to label
|
| 86 |
+
idx2label = {0: "Corn___Common_Rust", 1: "Corn___Gray_Leaf_Spot", ..., 16: "Sugarcane___Healthy"} # Add full mapping
|
| 87 |
+
print("Prediction:", idx2label[predicted_class])
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Real-World Applications
|
| 91 |
+
- Smart Farming: Disease detection via mobile/drones
|
| 92 |
+
|
| 93 |
+
- Scalable Monitoring: Surveying across large farmlands
|
| 94 |
+
|
| 95 |
+
- Yield Optimization: Early diagnosis = lower crop loss
|
| 96 |
+
|
| 97 |
+
## Citation
|
| 98 |
+
If you use this model, please cite it as:
|
| 99 |
+
|
| 100 |
+
**BibTeX:**
|
| 101 |
+
```
|
| 102 |
+
@misc{5cropdiseasedetection2025,
|
| 103 |
+
title = {Crop Disease Detection using EfficientNet-B3},
|
| 104 |
+
author = {Abdullahi Olalekan Abdulmumeen},
|
| 105 |
+
year = {2025},
|
| 106 |
+
url = {https://huggingface.co/VisionaryQuant/5_Crop_Disease_Detection}
|
| 107 |
+
}
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
**APA:**
|
| 111 |
+
```
|
| 112 |
+
Abdulmumeen, A. O. (2025). Crop disease detection using EfficientNet-B3 [Model]. Hugging Face. https://huggingface.co/VisionaryQuant/5_Crop_Disease_Detection
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
## Contact & Credits
|
| 116 |
+
Developed by Abdullahi Olalekan Abdulmumeen <br/>
|
| 117 |
+
For the NaijaFarmConsultAI 3MTT Knowledge Showcase project
|