Downloads · 30 days
137
37% of all-time downloads
ndunge23/SambaGuard-v2
SambaGuard-v2 is a object detection model from ndunge23. Use it when you need objects located in an image. It is set up for ultralytics. The card lists the license as apache-2.0.
SambaGuard AI is a YOLOv8-based object detection model for the early detection of Fall Armyworm (FAW) infestations in smallholder maize fields. The model was developed as part of a research project at Dedan Kimathi Un…
Downloads · 30 days
137
37% of all-time downloads
All-time downloads
369
Public
Repo size
187 MB
Likes
1
Public
Click a slice to open those files.
.pt45 MB · 32%
From the Hugging Face model README
SambaGuard AI is a YOLOv8-based object detection model for the early detection of Fall Armyworm (FAW) infestations in smallholder maize fields. The model was developed as part of a research project at Dedan Kimathi University of Technology, Kenya, targeting edge deployment on resource-constrained devices such as the Raspberry Pi 4.
The system is designed to address a documented gap in FAW management: smallholder farmers cannot scout frequently enough to catch FAW in its narrow early intervention window, and existing tools do not provide severity-graded, localized guidance. SambaGuard AI aims to close this gap through automated, camera-based detection at the field level.
This repository contains the trained model weights, evaluation metrics, training visualizations, and full experiment outputs for version 2.
The model detects four Fall Armyworm-related classes:
| Class ID | Class Name |
|---|---|
| 0 | Fall Armyworm Egg |
| 1 | Fall Armyworm Frass |
| 2 | Fall Armyworm Larva |
| 3 | Fall Armyworm Larval Damage |
The model was trained on a cleaned and validated subset of the KaraAgro AI Maize dataset, accessed via Dataset Ninja (https://datasetninja.com/kara-agro-ai-maize) in Supervisely format. The original dataset was published by KaraAgro AI and is available on Harvard Dataverse (DOI: 10.7910/DVN/CXUMDS, License: CC0 1.0).
Dataset preparation steps for v2:
Final dataset verification confirmed no missing images, no missing labels, no invalid annotations, and no unmatched image-label pairs across all splits.
| Split | Images | Labels |
|---|---|---|
| Train | 5,709 | 5,709 |
| Val | 1,320 | 1,320 |
| Test | 664 | 664 |
| Parameter | Value |
|---|---|
| Base model | yolov8s.pt (COCO pretrained) |
| Epochs | 100 |
| Early stopping patience | 20 |
| Batch size | 16 |
| Image size | 640 |
| Optimizer | Auto (AdamW) |
| Learning rate schedule | Cosine annealing |
| Mixed precision (AMP) | Enabled |
| Mosaic augmentation | Enabled |
| HSV augmentation | Enabled |
| Horizontal flip | Enabled |
| Hardware | NVIDIA Tesla T4 GPU |
Best checkpoint obtained at epoch 55.
Overall performance:
| Metric | Value |
|---|---|
| Precision | 0.479 |
| Recall | 0.376 |
| mAP50 | 0.347 |
| mAP50-95 | 0.137 |
Per-class performance:
| Class | Precision | Recall | mAP50 | mAP50-95 |
|---|---|---|---|---|
| Fall Armyworm Egg | 0.336 | 0.250 | 0.198 | 0.085 |
| Fall Armyworm Frass | 0.374 | 0.233 | 0.196 | 0.066 |
| Fall Armyworm Larva | 0.782 | 0.716 | 0.726 | 0.303 |
| Fall Armyworm Larval Damage | 0.425 | 0.304 | 0.267 | 0.093 |
The larva class achieves the strongest detection performance (mAP50 = 0.726), which is consistent with its larger visual signature and stronger representation in the training data. Egg and frass detection remain areas for improvement in subsequent versions.
| Metric | v1 Baseline | v2 Clean Dataset | Change |
|---|---|---|---|
| Precision | 0.486 | 0.479 | -0.007 |
| Recall | 0.401 | 0.376 | -0.025 |
| mAP50 | 0.368 | 0.347 | -0.021 |
| mAP50-95 | 0.144 | 0.137 | -0.007 |
| Larva mAP50 | 0.768 | 0.726 | -0.042 |
| Epochs trained | 50 | 100 (best at 55) | — |
Overall metrics show a slight decrease from v1. This is being investigated and attributed to differences in the effective training set composition after dataset cleaning — specifically the removal of out-of-bounds annotations that were previously counted as valid training signal. Further analysis is ongoing. See experiment notes below.
SambaGuard-v2/
├── weights/
│ ├── best.pt
│ └── last.pt
├── 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
│ ├── labels.jpg
│ └── labels_correlogram.jpg
├── training_samples/
├── validation_samples/
└── README.md
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()
This version introduced substantial dataset cleaning improvements over v1, including annotation repair, duplicate removal, bounding box validation, and egg class oversampling. Despite these improvements, overall mAP50 is marginally lower than v1 (0.347 vs 0.368).
This result is consistent with the hypothesis that dataset cleaning removed a number of noisy annotations that, while technically invalid, previously provided approximate training signal. The v2 dataset is cleaner and more reliable, but smaller in effective annotated objects. Subsequent experiments (v3, v4) will isolate the effect of augmentation and image resolution changes to determine the best path forward.
| Version | Key Change | Status |
|---|---|---|
| v1 | Baseline — 50 epochs, uncleaned dataset | Complete |
| v2 | Clean dataset — 100 epochs | Complete (this model) |
| v3 | Stronger augmentation for egg and frass classes | Planned |
| v4 | Image size increased to 960 | Planned |
Annastacia Ndunge Electrical and Electronics Engineering Dedan Kimathi University of Technology, Kenya