File size: 7,739 Bytes
0800d5c
 
b5e92f1
 
 
 
 
 
 
 
 
 
 
 
0800d5c
 
b5e92f1
0800d5c
b5e92f1
0800d5c
 
 
 
 
 
 
b5e92f1
0800d5c
 
 
b5e92f1
 
0800d5c
b5e92f1
0800d5c
b5e92f1
 
 
0800d5c
 
b5e92f1
 
0800d5c
 
 
 
 
 
 
 
b5e92f1
0800d5c
b5e92f1
 
0800d5c
 
 
b5e92f1
 
 
0800d5c
 
 
b5e92f1
 
 
 
0800d5c
 
 
b5e92f1
 
 
 
0800d5c
 
 
 
 
b5e92f1
 
 
 
0800d5c
b5e92f1
 
 
0800d5c
b5e92f1
 
 
0800d5c
b5e92f1
 
 
0800d5c
b5e92f1
 
 
 
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
 
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
 
b5e92f1
0800d5c
 
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
 
 
b5e92f1
0800d5c
b5e92f1
0800d5c
 
 
b5e92f1
 
0800d5c
 
 
b5e92f1
 
 
 
 
0800d5c
 
 
 
 
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
b5e92f1
0800d5c
 
 
b5e92f1
 
 
 
 
 
 
0800d5c
b5e92f1
 
 
 
 
 
 
 
0800d5c
 
 
 
b5e92f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
---
library_name: transformers
tags:
- agriculture
- plant-disease-classification
- computer-vision
- efficientnet
- Africa
license: apache-2.0
datasets:
- BrandonFors/Plant-Diseases-PlantVillage-Dataset
language:
- en
pipeline_tag: image-classification
---

# AgriScan-EfficientNet

 Crop Disease Classification Model



## Model Details

### Model Description

**AgriScan-EfficientNet** is a vision model fine-tuned to identify diseases in key crops critical to smallholder farmers in Africa. It is the core AI engine of the **AgriScan** platform—an initiative by **CDSA (Cross Domain Solution Architect)** to provide accessible, AI-powered agricultural intelligence.

This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.

- **Developed by:** [Vernard Sharbney Ngomane](https://huggingface.co/VCDSA) of CDSA
- **Funded by [optional]:** This model was developed as part of a pro-bono innovation project.
- **Shared by [optional]:** [More Information Needed]
- **Model type:** Image Classification (Fine-tuned EfficientNet)
- **Language(s) (NLP):** [More Information Needed]
- **License:** Apache 2.0
- **Finetuned from model [optional]:** [google/efficientnet-b3](https://huggingface.co/google/efficientnet-b3) (via PyTorch Image Models)
- **Demo:** [AgriScan Live Demo Space](https://huggingface.co/spaces/VCDSA/agriscan-demo)
### Model Sources [optional]

- **Repository:** [CDSA AgriScan Project](https://github.com/[Your-Github-Org]/AgriScan) *(Replace with actual link)*
- **Paper (For EfficientNet):** [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks](https://arxiv.org/abs/1905.11946)

- **Repository:** [More Information Needed]
- **Paper [optional]:** [More Information Needed]
- **Demo [optional]:** [More Information Needed]


### Direct Use

This model is intended for **direct use in agricultural decision-support systems**. Its primary function is to analyze images of plant leaves and predict the presence and type of disease.

- **Primary Use Case:** Integration into mobile applications (via TFLite), web APIs, or messaging bots (WhatsApp) to provide instant disease diagnosis for farmers and agricultural extension officers.
- **Educational Use:** Can be used in training materials or apps to help students and farmers learn to identify common crop diseases.

### Out-of-Scope Use

- **Medical or Human Diagnosis:** This model is strictly for plant disease classification.
- **Absolute Decision-Making:** Predictions are advisory. Final agricultural decisions should involve human expertise and local context.
- **Non-Visual Data:** Cannot analyze soil samples, weather patterns, or textual descriptions alone.

## Bias, Risks, and Limitations

- **Geographic & Crop Bias:** Trained primarily on the PlantVillage dataset, which may not fully represent the diversity of disease manifestations, camera qualities, and environmental conditions (e.g., specific lighting, soil backgrounds) found across all African farms.
- **Limited Scope:** Classifies diseases present in the training set. It is not an "unknown disease detector" and may misclassify novel or regional-specific pathogens.
- **Field Condition Performance:** Lab/studio images from PlantVillage may lead to lower accuracy on blurry, angled, or occluded field photos.
- **Mitigation Strategy:** The AgriScan project employs **IBM AI Fairness 360 (AIF360)** for bias auditing and uses a confidence threshold. Low-confidence predictions are flagged for human review.

### Recommendations

Users should:
1.  Treat outputs as a **first alert system**, not a definitive diagnosis.
2.  Be aware of the model's training background and correlate predictions with local agricultural expert knowledge.
3.  Report misclassifications to help improve future model versions.

## How to Get Started with the Model

Use the code below to get started with the model.

[```python
from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image
import torch]

# Load model and processor from the Hub
processor = AutoImageProcessor.from_pretrained("VCDSA/agriscan-efficientnet")
model = AutoModelForImageClassification.from_pretrained("VCDSA/agriscan-efficientnet")

# Load and preprocess an image
image = Image.open("path_to_your_leaf_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")

# Run inference
with torch.no_grad():
    logits = model(**inputs).logits

# Get prediction
predicted_class_idx = logits.argmax(-1).item()
label = model.config.id2label[predicted_class_idx]
print(f"Predicted disease: {label}")

## Training Details

### Training Data

Primary Dataset: Plant-Diseases-PlantVillage-Dataset

Description: Contains over 54,000 images of healthy and diseased leaves across 14 crop species and 38 disease classes.

Preprocessing: Images were resized to 300x300 pixels, normalized using ImageNet statistics, and augmented with random horizontal flips and slight rotations to improve generalization.


### Training Procedure

Fine-tuning Regime: Standard supervised fine-tuning on the PlantVillage classification task.

Optimizer: AdamW

Learning Rate: 5e-5 with linear decay

Epochs: 10

Framework: PyTorch, using Hugging Face transformers and timm libraries.


## Evaluation


### Testing Data, Factors & Metrics

Testing Data: 20% hold-out split from the PlantVillage dataset.

Primary Metric: Top-1 Accuracy

Secondary Metrics: Precision, Recall, F1-Score (computed per class).

### Results

Overall Accuracy: 98.7% on the PlantVillage test set.

Note on Real-World Performance: This high accuracy reflects performance on curated lab images. Field performance is actively being evaluated through pilot studies and is expected to be lower. Continuous evaluation with real farmer data is a core part of the AgriScan development cycle.

## Model Examination [optional]

Explainability
To build trust and transparency, the AgriScan project uses IBM AI Explainability 360 (AIX360) to generate saliency maps (e.g., Grad-CAM). These maps visually highlight the regions of the leaf most influential to the model's prediction, helping users and developers understand the model's "reasoning."

## Environmental Impact

- **Hardware Type:** 1 x NVIDIA Tesla T4 GPU
- **Hours used:** ~4 hours
- **Cloud Provider:** Google Colab
- **Carbon Emitted:** Estimated < 0.5 kgCO2eq (based on ML CO2 impact calculator)
- **Mitigation:** The model's efficiency (EfficientNet architecture) and intended use case—potentially reducing pesticide overuse and crop loss—aim to offset its training footprint with positive environmental impact.

## Technical Specifications [optional]

### Model Architecture and Objective

EfficientNet-B3

### Input

3-channel RGB image (300x300 pixels)

#### Output

Logits over 38 disease classes (compatible with PlantVillage labels).

#### Export Formats

Available in PyTorch (.bin), ONNX (.onnx), and TensorFlow Lite (.tflite) formats for cross-platform deployment.

## Citation [optional]

@misc{agriscan2025,
  author = {Ngomane, Vernard Sharbney and CDSA},
  title = {AgriScan: An AI-Powered Agricultural Intelligence Platform},
  year = {2025},
  publisher = {Hugging Face},
  url = {https://huggingface.co/VCDSA/agriscan-efficientnet}
}

@article{tan2020efficientnet,
  title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks},
  author={Tan, Mingxing and Le, Quoc V.},
  journal={International Conference on Machine Learning},
  pages={6105--6114},
  year={2020},
  publisher={PMLR}
}


## Model Card Contact

For questions, comments, or partnership inquiries regarding the AgriScan model, please open a discussion on the AgriScan Hub community.