Commit
·
e18b6ce
1
Parent(s):
3cd9631
add model weights
Browse files
README.md
CHANGED
|
@@ -50,6 +50,49 @@ This is to show how to create a computer vision model for applications such as a
|
|
| 50 |
|
| 51 |
### Direct Use
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
### Results
|
| 55 |
| Class | Images | Instances | P | R | mAP50 |
|
|
|
|
| 50 |
|
| 51 |
### Direct Use
|
| 52 |
|
| 53 |
+
- Install [yolov5](https://github.com/fcakyon/yolov5-pip):
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
pip install -U yolov5
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
- Load model and perform prediction:
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
import yolov5
|
| 63 |
+
|
| 64 |
+
# load model
|
| 65 |
+
model = yolov5.load('ljamesdatascience/BillboardAdvertDetectionYOLOV5')
|
| 66 |
+
|
| 67 |
+
# set model parameters
|
| 68 |
+
model.conf = 0.25 # NMS confidence threshold
|
| 69 |
+
model.iou = 0.45 # NMS IoU threshold
|
| 70 |
+
model.agnostic = False # NMS class-agnostic
|
| 71 |
+
model.multi_label = False # NMS multiple labels per box
|
| 72 |
+
model.max_det = 1000 # maximum number of detections per image
|
| 73 |
+
|
| 74 |
+
# set image
|
| 75 |
+
img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
|
| 76 |
+
|
| 77 |
+
# perform inference
|
| 78 |
+
results = model(img, size=640)
|
| 79 |
+
|
| 80 |
+
# inference with test time augmentation
|
| 81 |
+
results = model(img, augment=True)
|
| 82 |
+
|
| 83 |
+
# parse results
|
| 84 |
+
predictions = results.pred[0]
|
| 85 |
+
boxes = predictions[:, :4] # x1, y1, x2, y2
|
| 86 |
+
scores = predictions[:, 4]
|
| 87 |
+
categories = predictions[:, 5]
|
| 88 |
+
|
| 89 |
+
# show detection bounding boxes on image
|
| 90 |
+
results.show()
|
| 91 |
+
|
| 92 |
+
# save results into "results/" folder
|
| 93 |
+
results.save(save_dir='results/')
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
|
| 97 |
### Results
|
| 98 |
| Class | Images | Instances | P | R | mAP50 |
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14b36c2d26ce19778db6cfb6d1b88a74043c1eea106e2be1ba0897daac458d69
|
| 3 |
+
size 14401448
|