Commit
·
2166828
1
Parent(s):
68b78b9
Update README.md
Browse files
README.md
CHANGED
|
@@ -85,50 +85,40 @@ Users should be informed about the model's limitations and potential biases. Fur
|
|
| 85 |
|
| 86 |
Load model and perform prediction:
|
| 87 |
|
|
|
|
|
|
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
- Install [yolov5](https://github.com/fcakyon/yolov5-pip):
|
| 92 |
|
| 93 |
```bash
|
| 94 |
-
pip install
|
| 95 |
```
|
| 96 |
|
| 97 |
-
|
| 98 |
|
| 99 |
```python
|
| 100 |
-
import
|
| 101 |
|
| 102 |
# load model
|
| 103 |
-
model =
|
| 104 |
-
|
| 105 |
# set model parameters
|
| 106 |
-
model.conf = 0.25 # NMS confidence threshold
|
| 107 |
-
model.iou = 0.45 # NMS IoU threshold
|
| 108 |
-
model.
|
| 109 |
-
model.
|
| 110 |
-
|
| 111 |
|
| 112 |
# set image
|
| 113 |
-
|
| 114 |
|
| 115 |
# perform inference
|
| 116 |
-
results = model(
|
| 117 |
-
|
| 118 |
-
# inference with test time augmentation
|
| 119 |
-
results = model(img, augment=True)
|
| 120 |
-
|
| 121 |
-
# parse results
|
| 122 |
-
predictions = results.pred[0]
|
| 123 |
-
boxes = predictions[:, :4] # x1, y1, x2, y2
|
| 124 |
-
scores = predictions[:, 4]
|
| 125 |
-
categories = predictions[:, 5]
|
| 126 |
-
|
| 127 |
-
# show detection bounding boxes on image
|
| 128 |
-
results.show()
|
| 129 |
|
| 130 |
-
#
|
| 131 |
-
results.
|
|
|
|
|
|
|
| 132 |
```
|
| 133 |
|
| 134 |
- Finetune the model on your custom dataset:
|
|
|
|
| 85 |
|
| 86 |
Load model and perform prediction:
|
| 87 |
|
| 88 |
+
## How to Get Started with the Model
|
| 89 |
+
To get started with the YOLOv8s object Detection and Classification model, follow these steps:
|
| 90 |
|
| 91 |
+
1. Install [ultralyticsplus](https://github.com/fcakyon/ultralyticsplus) and [ultralytics](https://github.com/ultralytics/ultralytics) libraries using pip:
|
|
|
|
|
|
|
| 92 |
|
| 93 |
```bash
|
| 94 |
+
pip install ultralyticsplus ultralytics
|
| 95 |
```
|
| 96 |
|
| 97 |
+
2. Load the model and perform prediction using the provided code snippet.
|
| 98 |
|
| 99 |
```python
|
| 100 |
+
from ultralyticsplus import YOLO, render_result
|
| 101 |
|
| 102 |
# load model
|
| 103 |
+
model = YOLO('foduucom/plant-leaf-detection-and-classification')
|
| 104 |
+
|
| 105 |
# set model parameters
|
| 106 |
+
model.overrides['conf'] = 0.25 # NMS confidence threshold
|
| 107 |
+
model.overrides['iou'] = 0.45 # NMS IoU threshold
|
| 108 |
+
model.overrides['agnostic_nms'] = False # NMS class-agnostic
|
| 109 |
+
model.overrides['max_det'] = 1000 # maximum number of detections per image
|
| 110 |
+
|
| 111 |
|
| 112 |
# set image
|
| 113 |
+
image = 'path/to/your/image'
|
| 114 |
|
| 115 |
# perform inference
|
| 116 |
+
results = model.predict(image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
+
# observe results
|
| 119 |
+
print(results[0].boxes)
|
| 120 |
+
render = render_result(model=model, image=image, result=results[0])
|
| 121 |
+
render.show()
|
| 122 |
```
|
| 123 |
|
| 124 |
- Finetune the model on your custom dataset:
|