Spaces:
Runtime error
Runtime error
Amar Gill
commited on
Commit
·
13b7ff6
1
Parent(s):
3272b36
make debugger script
Browse files- debugger.py +21 -0
debugger.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from ultralyticsplus import YOLO, render_result
|
2 |
+
|
3 |
+
# load model
|
4 |
+
model = YOLO('keremberke/yolov8m-hard-hat-detection')
|
5 |
+
|
6 |
+
# set model parameters
|
7 |
+
model.overrides['conf'] = 0.25 # NMS confidence threshold
|
8 |
+
model.overrides['iou'] = 0.45 # NMS IoU threshold
|
9 |
+
model.overrides['agnostic_nms'] = False # NMS class-agnostic
|
10 |
+
model.overrides['max_det'] = 1000 # maximum number of detections per image
|
11 |
+
|
12 |
+
# set image
|
13 |
+
image = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
|
14 |
+
|
15 |
+
# perform inference
|
16 |
+
results = model.predict(image)
|
17 |
+
|
18 |
+
# observe results
|
19 |
+
print(results[0].boxes)
|
20 |
+
render = render_result(model=model, image=image, result=results[0])
|
21 |
+
render.show()
|