My internship project with the Council for Scientific and Industrial Research in Accra
---
title: CropScan AI
emoji: 🌿
colorFrom: green
colorTo: emerald
sdk: docker
app_port: 7860
short_description: Detect 29 crop diseases from leaf photos using EfficientNet-B0 (99.56% accuracy)
tags:
- agriculture
- computer-vision
- image-classification
- pytorch
- efficientnet
pinned: false
---
# Crop Disease Detection 🌿
A CNN-based image classifier that detects **29 crop diseases** across 9 plant types using transfer learning with **EfficientNet-B0**.
> **Test Accuracy: 99.56%** · Macro F1: 0.995 · 29 classes · 67,000+ images
## Results
| Metric | Score |
|--------|-------|
| Test Accuracy | **99.56%** |
| Macro Avg Precision | 99.6% |
| Macro Avg Recall | 99.5% |
| Macro Avg F1 | 99.5% |
| Model size | ~19 MB |
25 out of 29 classes achieved a **perfect F1 score of 1.000**. The only misclassifications (6 total out of 1,354 test images) were between visually similar Corn leaf diseases.
## Supported Crops & Diseases
| Crop | Conditions |
|------|-----------|
| Apple | Apple Scab, Black Rot, Cedar Apple Rust, Healthy |
| Bell Pepper | Bacterial Spot, Healthy |
| Cherry | Powdery Mildew, Healthy |
| Corn (Maize) | Cercospora Leaf Spot, Common Rust, Northern Leaf Blight, Healthy |
| Grape | Black Rot, Esca (Black Measles), Leaf Blight, Healthy |
| Peach | Bacterial Spot, Healthy |
| Potato | Early Blight, Late Blight, Healthy |
| Strawberry | Leaf Scorch, Healthy |
| Tomato | Bacterial Spot, Early Blight, Late Blight, Septoria Leaf Spot, Yellow Leaf Curl Virus, Healthy |
## Project Structure
```
crop-disease-detection/
├── dataset/ ← Your dataset (Train/Val/Test splits)
├── src/
│ ├── config.py ← Hyperparameters & paths
│ ├── dataset.py ← Dataset class & DataLoaders
│ ├── model.py ← EfficientNet-B0 transfer learning model
│ ├── train.py ← Two-phase training loop
│ ├── evaluate.py ← Test set evaluation & confusion matrix
│ └── predict.py ← Single-image inference CLI
├── outputs/
│ …