|
--- |
|
license: cc-by-sa-4.0 |
|
datasets: |
|
- KaraAgroAI/CADI-AI |
|
language: |
|
- en |
|
metrics: |
|
- mape |
|
pipeline_tag: object-detection |
|
tags: |
|
- object detection |
|
- vision |
|
--- |
|
|
|
|
|
## Cashew Disease Identification with AI (CADI-AI) Model |
|
|
|
### Model Description |
|
|
|
Object detection model trained using YOLO v5x. 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: |
|
|
|
```python |
|
import torch |
|
|
|
# load model |
|
model = torch.hub.load('ultralytics/yolov5', 'KaraAgroAI/CADI-AI') |
|
|
|
# Images |
|
img = ['/path/to/CADI-AI-image.jpg']# batch of images |
|
|
|
# set model parameters |
|
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 |
|
``` |
|
|