linhcuem commited on
Commit
f890670
1 Parent(s): 8451257

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
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
- # for r in results:
62
- # for c in r.boxes.cls:
63
- # c = (names[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 c in names:
73
- object_counts[c] += 1
74
- elif c not in names:
75
- object_counts[c] = 1
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: