Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: gpl-3.0
|
| 3 |
+
inference: false
|
| 4 |
+
tags:
|
| 5 |
+
- object-detection
|
| 6 |
+
- computer-vision
|
| 7 |
+
- vision
|
| 8 |
+
- yolo
|
| 9 |
+
- yolov5
|
| 10 |
---
|
| 11 |
+
|
| 12 |
+
### How to use
|
| 13 |
+
|
| 14 |
+
- Install yolov5:
|
| 15 |
+
|
| 16 |
+
```bash
|
| 17 |
+
pip install -U yolov5
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
- Load model and perform prediction:
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
import yolov5
|
| 24 |
+
|
| 25 |
+
# load model
|
| 26 |
+
model = yolov5.load('kadirnar/deprem_model_v1')
|
| 27 |
+
|
| 28 |
+
# set model parameters
|
| 29 |
+
model.conf = 0.25 # NMS confidence threshold
|
| 30 |
+
model.iou = 0.45 # NMS IoU threshold
|
| 31 |
+
model.agnostic = False # NMS class-agnostic
|
| 32 |
+
model.multi_label = False # NMS multiple labels per box
|
| 33 |
+
model.max_det = 1000 # maximum number of detections per image
|
| 34 |
+
|
| 35 |
+
# set image
|
| 36 |
+
img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
|
| 37 |
+
|
| 38 |
+
# perform inference
|
| 39 |
+
results = model(img)
|
| 40 |
+
|
| 41 |
+
# inference with larger input size
|
| 42 |
+
results = model(img, size=640)
|
| 43 |
+
|
| 44 |
+
# inference with test time augmentation
|
| 45 |
+
results = model(img, augment=True)
|
| 46 |
+
|
| 47 |
+
# parse results
|
| 48 |
+
predictions = results.pred[0]
|
| 49 |
+
boxes = predictions[:, :4] # x1, y1, x2, y2
|
| 50 |
+
scores = predictions[:, 4]
|
| 51 |
+
categories = predictions[:, 5]
|
| 52 |
+
|
| 53 |
+
# show detection bounding boxes on image
|
| 54 |
+
results.show()
|
| 55 |
+
|
| 56 |
+
# save results into "results/" folder
|
| 57 |
+
results.save(save_dir='results/')
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
- Finetune the model on your custom dataset:
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
yolov5 train --img 640 --batch 16 --weights kadirnar/deprem_model_v1 --epochs 10 --device cuda:0
|
| 64 |
+
```
|