linhcuem commited on
Commit
ffb2d1b
1 Parent(s): 39cc8c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -50,12 +50,13 @@ def yolov8_img_inference(
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('lo_ytv')]
54
  # ('hop_dln','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, count_result
61
 
 
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('lo_ytv')]
54
  # ('hop_dln','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[0].boxes.xyxy[0].value_counts('name')
60
  # count_result = results.pandas().xyxy[0].value_counts('name')
61
  return render, count_result
62