Spaces:
Runtime error
Runtime error
Commit
·
4ea1da3
1
Parent(s):
e9858b2
Update detection.py
Browse files- detection.py +18 -18
detection.py
CHANGED
@@ -15,24 +15,24 @@ class ObjectDetection:
|
|
15 |
return model
|
16 |
|
17 |
def v8_score_frame(self, frame):
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
def get_coords(self, frame, row):
|
38 |
return int(row[0]), int(row[1]), int(row[2]), int(row[3])
|
|
|
15 |
return model
|
16 |
|
17 |
def v8_score_frame(self, frame):
|
18 |
+
results = self.model(frame)
|
19 |
+
|
20 |
+
labels = []
|
21 |
+
confidences = []
|
22 |
+
coords = []
|
23 |
+
|
24 |
+
for result in results:
|
25 |
+
boxes = result.boxes.cpu().numpy()
|
26 |
+
|
27 |
+
label = boxes.cls
|
28 |
+
conf = boxes.conf
|
29 |
+
coord = boxes.xyxy
|
30 |
+
|
31 |
+
labels.extend(label)
|
32 |
+
confidences.extend(conf)
|
33 |
+
coords.extend(coord)
|
34 |
+
|
35 |
+
return labels, confidences, coords
|
36 |
|
37 |
def get_coords(self, frame, row):
|
38 |
return int(row[0]), int(row[1]), int(row[2]), int(row[3])
|