Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -58,21 +58,21 @@ def yolov8_img_inference(
|
|
58 |
# count_result = results[0].boxes.cls.tolist()
|
59 |
|
60 |
object_counts = {x: 0 for x in names}
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
clist = results[0].boxes.cls
|
69 |
-
cls = set()
|
70 |
-
for cno in clist:
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
present_objects = object_counts.copy()
|
77 |
|
78 |
for i in object_counts:
|
|
|
58 |
# count_result = results[0].boxes.cls.tolist()
|
59 |
|
60 |
object_counts = {x: 0 for x in names}
|
61 |
+
for r in results:
|
62 |
+
for c in r.boxes.cls:
|
63 |
+
c = int(c)
|
64 |
+
if c in names:
|
65 |
+
object_counts[c] += 1
|
66 |
+
elif c not in names:
|
67 |
+
object_counts[c] = 1
|
68 |
+
# clist = results[0].boxes.cls
|
69 |
+
# cls = set()
|
70 |
+
# for cno in clist:
|
71 |
+
# cls.add(model.names[int(cno)])
|
72 |
+
# if cno in names:
|
73 |
+
# object_counts[cno] += 1
|
74 |
+
# elif cno not in names:
|
75 |
+
# object_counts[cno] = 1
|
76 |
present_objects = object_counts.copy()
|
77 |
|
78 |
for i in object_counts:
|