Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,12 +49,13 @@ def yolov8_img_inference(
|
|
49 |
render = render_result(model=model, image=image, result=results[0])
|
50 |
# get the model names list
|
51 |
names = model.names
|
52 |
-
# get the '
|
53 |
-
|
|
|
54 |
# obj_id = list(names)[list(names.values()).index([0])]
|
55 |
# count 'car' objects in the results
|
56 |
# count_result = results[0].boxes.cls[0].item()
|
57 |
-
|
58 |
# count_result = results.pandas().xyxy[0].value_counts('name')
|
59 |
return render, names
|
60 |
|
|
|
49 |
render = render_result(model=model, image=image, result=results[0])
|
50 |
# get the model names list
|
51 |
names = model.names
|
52 |
+
# get the 'obj' class id
|
53 |
+
obj_id = list(names)[list(names.values()).index('hop_dln')
|
54 |
+
# ,'hop_jn','hop_vtg','hop_ytv','lo_kids', 'lo_ytv','loc_dln','loc_jn','loc_kids','loc_ytv')]
|
55 |
# obj_id = list(names)[list(names.values()).index([0])]
|
56 |
# count 'car' objects in the results
|
57 |
# count_result = results[0].boxes.cls[0].item()
|
58 |
+
count_result = results[0].boxes.cls.tolist().count(obj_id)
|
59 |
# count_result = results.pandas().xyxy[0].value_counts('name')
|
60 |
return render, names
|
61 |
|