Pest and Disease Detector β€” Maize Fall Armyworm and Maize Streak Disease Detection

Overview

This model is a YOLOv8s-based object detection model trained to detect both Fall Armyworm (FAW) pest infestations and Maize Streak Disease in smallholder maize farms. It is part of the SambaGuard AI system, developed at Dedan Kimathi University of Technology, Kenya, targeting edge deployment on resource-constrained devices such as the Raspberry Pi 5.

The model extends the FAW-only v2 model by adding disease detection capability, addressing the requirement for a unified pest and disease monitoring system that can operate offline in low-connectivity field environments.

This repository contains the trained model weights, evaluation metrics, training visualizations, and full experiment outputs.


Detected Classes

Class ID Class Name
0 Fall Armyworm Egg
1 Fall Armyworm Frass
2 Fall Armyworm Larva
3 Fall Armyworm Larval Damage
4 Healthy Maize
5 Maize Streak Disease

Model Architecture

Property Value
Architecture YOLOv8s
Framework Ultralytics / PyTorch
Input size 640 x 640 pixels
Parameters 11.1M
GFLOPs 28.4
Export formats ONNX, TFLite
Number of classes 6

Dataset

The model was trained on the MaizeFall-Army dataset by CDAC, hosted on Roboflow Universe. The original dataset was collected by KaraAgro AI from maize farms across Ghana and is available on Harvard Dataverse (DOI: 10.7910/DVN/CXUMDS, License: CC BY 4.0).

Dataset preparation steps:

  • Removed two ambiguous classes: healthy-images and none-healthy
  • Remapped remaining 6 classes to contiguous IDs (0–5)
  • Oversampled minority classes (fall-armyworm-egg and maize-streak-disease) to approximately 2,000 images each
  • Verified all image-label pairs across all splits
  • Confirmed zero out-of-bounds bounding box coordinates
Split Images Labels
Train 20,659 20,659
Val 1,642 1,642
Test 839 839

Training Configuration

Parameter Value
Base model yolov8s.pt (COCO pretrained)
Epochs 100
Early stopping patience 20
Batch size 16
Image size 640
Learning rate schedule Cosine annealing
Cache Disk
Seed 42
Hardware NVIDIA Tesla T4 GPU

Validation Results

Best checkpoint obtained at epoch 56.

Overall

Metric Value
Precision 0.413
Recall 0.167
mAP50 0.166
mAP50-95 0.123

Per-Class Performance

Class Precision Recall mAP50 mAP50-95
Fall Armyworm Egg 0.0917 0.00763 0.000923 0.000138
Fall Armyworm Frass 0.0555 0.000471 0.00657 β€”
Fall Armyworm Larva 0.330 0.248 0.178 β€”
Fall Armyworm Larval Damage 0.362 0.0148 0.0184 β€”
Healthy Maize 0.830 0.0746 0.125 β€”
Maize Streak Disease 0.810 0.658 0.666 0.607

Full per-class metrics, training curves, confusion matrix, and PR curves are available in the plots/ and metrics/ folders of this repository.


Experiment Log

Version Dataset Classes Epochs mAP50 Status
v1 KaraAgro FAW-only 4 50 0.368 Complete
v2 KaraAgro FAW-only (cleaned) 4 100 (best 55) 0.347 Complete
v3 Roboflow 6-class 6 100 (best 49) 0.161 Complete
v4 (this model) Roboflow 6-class + oversampling 6 100 (best 56) 0.166 Complete

Repository Structure

Pest-Disease-Detector/
β”œβ”€β”€ weights/
β”‚   β”œβ”€β”€ best.pt
β”‚   β”œβ”€β”€ last.pt
β”‚   β”œβ”€β”€ best.onnx
β”‚   └── best.tflite
β”œβ”€β”€ metrics/
β”‚   └── results.csv
β”œβ”€β”€ plots/
β”‚   β”œβ”€β”€ results.png
β”‚   β”œβ”€β”€ confusion_matrix.png
β”‚   β”œβ”€β”€ confusion_matrix_normalized.png
β”‚   β”œβ”€β”€ PR_curve.png
β”‚   β”œβ”€β”€ P_curve.png
β”‚   β”œβ”€β”€ R_curve.png
β”‚   └── F1_curve.png
β”œβ”€β”€ args.yaml
└── README.md

Usage

Install the required library:

pip install ultralytics

Run inference on an image:

from ultralytics import YOLO

model = YOLO("weights/best.pt")

results = model.predict(
    source="image.jpg",
    imgsz=640,
    conf=0.25
)

results[0].show()

Known Limitations

  • Egg and frass detection performance is low due to class imbalance in the training data β€” these classes are significantly underrepresented compared to larval damage and healthy maize
  • Overall mAP50 (0.166) is lower than the FAW-only v2 model (0.347) β€” adding disease classes introduced class imbalance that reduced FAW detection performance
  • Maize streak disease detection performs consistently well (estimated mAP50 ~0.65) due to its visually distinct symptoms

Future Work

  • Improved class balancing strategy for minority FAW classes
  • Larger and more diverse dataset for egg and frass classes
  • Edge export optimization for Raspberry Pi 5 deployment
  • Integration with Swahili-language LLM advisory layer for farmer SMS guidance
  • Field validation with smallholder farmers in Kenya

Related Resources


Citation

@misc{sambaguard2026,
  author       = {Annastacia Ndunge},
  title        = {Pest and Disease Detector: YOLOv8s for Fall Armyworm and Maize Streak Disease Detection},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/ndunge23/Pest-Disease-Detector}},
  note         = {Part of the SambaGuard AI project}
}

License

This project is licensed under the Apache 2.0 License.


Author

Annastacia Ndunge Electrical and Electronic Engineering, Dedan Kimathi University of Technology, Kenya

GitHub: aneneahs-kanaks Hugging Face: ndunge23 LinkedIn: Annastacia Ndunge

Downloads last month
49
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support