license: agpl-3.0
datasets:
- KaraAgroAI/CADI-AI
language:
- en
metrics:
- mape
tags:
- object detection
- vision
- yolo
pipeline_tag: object-detection
library_name: transformers
Cashew Disease Identification with AI (CADI-AI) Model
Model Description
Object detection model trained using YOLO v5x, 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.
CADI-AI dataset is available in hugging face dataset hub.
Intended uses & limitations
You can use the raw model for object detection on cashew images.
How to use
- Load model and perform prediction:
pip install -U ultralytics
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:
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.