File size: 4,297 Bytes
66f9723 71d49e1 79b5216 089f3ea 79b5216 edbf0b3 5112449 c11406b 66f9723 79b5216 155bc64 e12e024 79b5216 c6b6140 a562547 79b5216 3fe3ff3 e12e024 3fe3ff3 79b5216 edbf0b3 79b5216 edbf0b3 79b5216 2d56af1 79b5216 30eb2a3 79b5216 e11a9ef 9532f26 cd63a9d 7b3ae74 c6b6140 e12e024 49c81a9 c6b6140 9532f26 e11a9ef fa9c6b7 |
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 |
---
license: agpl-3.0
datasets:
- KaraAgroAI/CADI-AI
language:
- en
library_name: yolo
tags:
- object detection
- vision
- yolo
pipeline_tag: object-detection
metrics:
- mape
---
## Cashew Disease Identification with AI (CADI-AI) Model
### Model Description
Object detection model trained using [YOLO v5x](https://github.com/ultralytics/yolov5/releases), a SOTA object detection algorithm.
The model was pre-trained on the Cashew Disease Identification with AI (CADI-AI) train set (3788 images) at a resolution of 640x640 pixels.
The CADI-AI dataset is available via [Kaggle](https://www.kaggle.com/datasets/karaagroaiprojects/cadi-ai) and
[HuggingFace](https://huggingface.co/datasets/KaraAgroAI/CADI-AI).
## Intended uses
You can use the raw model for object detection on cashew images.
The model was initially developed to inform users whether cashew trees suffer from:
- pest infection, i.e. damage to crops by insects or pests
- disease, i.e. attacks on crops by microorganisms
- abiotic stress caused by non-living factors (e.g. environmental factors like weather or soil conditions or the lack of mineral nutrients to the crop).
KaraAgro AI developed the model for the initiatives
[Market-Oriented Value Chains for Jobs & Growth in the ECOWAS Region (MOVE)](https://www.giz.de/en/worldwide/108524.html) and
[FAIR Forward - Artificial Intelligence for All](https://www.bmz-digital.global/en/overview-of-initiatives/fair-forward/).
Both initiatives are implemented by the Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ) on behalf of the German Federal Ministry for Economic Cooperation and Development (BMZ).
### How to use
- Load model and perform prediction:
```bash
pip install -U ultralytics
```
```python
import torch
# load model
model = torch.hub.load('ultralytics/yolov5', 'custom', path='CADI-AI/yolov5_0.65map_exp7_best.pt', force_reload=True)
# Images
img = ['/path/to/your/image.jpg']# batch of images
# set model parameters
# set Non-Maximum-Suppression(NMS) threshold to define
# minimum confidence score that a bounding box must have in order to be kept.
model.conf = 0.20 # NMS confidence threshold
# perform inference
results = model(img, size=640)
# Results
results.print()
results.xyxy[0] # img1 predictions (tensor)
results.pandas().xyxy[0] # img1 predictions (pandas)
# parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, y1, x2, y2
scores = predictions[:, 4]
categories = predictions[:, 5]
# show detection bounding boxes on image
results.show()
# save results into "results/" folder
results.save(save_dir='results/')
```
- Finetune the model on your custom dataset:
```bash
yolov5 train --data data.yaml --img 640 --batch 16 --weights KaraAgroAI/CADI-AI --epochs 10
```
### Model performance
| Class | Precision | Recall | mAP@50 | mAP@50-95 |
| --- | --- | --- | --- | --- |
| all | 0.663 | 0.632 | 0.648 | 0.291 |
| insect | 0.794 | 0.811 | 0.815 | 0.39 |
| abiotic | 0.682 | 0.514 | 0.542 | 0.237 |
| disease | 0.594 | 0.571 | 0.588 | 0.248 |
### Limitations of the Model
The model has a few limitations that affect its performance in distinguishing between the disease class and the abiotic class.
The primary challenge lies in the similarity between these two classes within a typical farm setting.
The model may encounter difficulties in accurately differentiating between them due to their overlapping characteristics.
This limitation is an inherent challenge in the dataset and can impact the model's accuracy when classifying these classes.
However, it is worth noting that the model exhibits strong performance when it comes to the insect class.
This is attributed to the distinct characteristics of insect class, which make them easier to identify and classify accurately.
### Demo
[CADI-AI Spaces demonstration](https://huggingface.co/spaces/KaraAgroAI/CADI-AI)
### Project Repo
If you want to know how the model and dataset has been used further for the GIZ-funded activity, please have a look at:
- The [GitHub repository](https://github.com/karaagro/cadi-ai) for the CADI AI desktop application
### Example prediction
<div align="center">
<img width="640" alt="KaraAgroAI/CADI-AI" src="https://huggingface.co/KaraAgroAI/CADI-AI/resolve/main/sample.jpg">
</div> |