KaraAgroAI
commited on
Commit
•
79b5216
1
Parent(s):
665459b
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,69 @@
|
|
1 |
---
|
2 |
license: cc-by-sa-4.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: cc-by-sa-4.0
|
3 |
+
datasets:
|
4 |
+
- KaraAgroAI/CADI-AI
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
metrics:
|
8 |
+
- mape
|
9 |
+
pipeline_tag: object-detection
|
10 |
+
tags:
|
11 |
+
- object detection
|
12 |
+
- vision
|
13 |
---
|
14 |
+
|
15 |
+
|
16 |
+
## Cashew Disease Identification with AI (CADI-AI) Model
|
17 |
+
|
18 |
+
### Model Description
|
19 |
+
|
20 |
+
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.
|
21 |
+
CADI-AI dataset is available in hugging face dataset hub
|
22 |
+
|
23 |
+
## Intended uses & limitations
|
24 |
+
|
25 |
+
You can use the raw model for object detection on cashew images.
|
26 |
+
|
27 |
+
### How to use
|
28 |
+
|
29 |
+
- Load model and perform prediction:
|
30 |
+
|
31 |
+
```python
|
32 |
+
import torch
|
33 |
+
|
34 |
+
# load model
|
35 |
+
model = torch.hub.load('ultralytics/yolov5', 'KaraAgroAI/CADI-AI')
|
36 |
+
|
37 |
+
# Images
|
38 |
+
img = ['/path/to/CADI-AI-image.jpg']# batch of images
|
39 |
+
|
40 |
+
# set model parameters
|
41 |
+
model.conf = 0.20 # NMS confidence threshold
|
42 |
+
|
43 |
+
# perform inference
|
44 |
+
results = model(img, size=640)
|
45 |
+
|
46 |
+
# Results
|
47 |
+
results.print()
|
48 |
+
|
49 |
+
results.xyxy[0] # img1 predictions (tensor)
|
50 |
+
results.pandas().xyxy[0] # img1 predictions (pandas)
|
51 |
+
|
52 |
+
# parse results
|
53 |
+
predictions = results.pred[0]
|
54 |
+
boxes = predictions[:, :4] # x1, y1, x2, y2
|
55 |
+
scores = predictions[:, 4]
|
56 |
+
categories = predictions[:, 5]
|
57 |
+
|
58 |
+
# show detection bounding boxes on image
|
59 |
+
results.show()
|
60 |
+
|
61 |
+
# save results into "results/" folder
|
62 |
+
results.save(save_dir='results/')
|
63 |
+
```
|
64 |
+
|
65 |
+
- Finetune the model on your custom dataset:
|
66 |
+
|
67 |
+
```bash
|
68 |
+
yolov5 train --data data.yaml --img 640 --batch 16 --weights KaraAgroAI/CADI-AI --epochs 10
|
69 |
+
```
|