姜尧 2023-11-10 09:48:21 +08:00
commit f450605468
4 changed files with 6 additions and 2 deletions

8
app.py
View File

@ -126,11 +126,15 @@ def worker(id,source,region=None,stream=False):
name = model.model.names[class_id] name = model.model.names[class_id]
if name in names: if name in names:
print("Name duplicate",name) print("Name duplicate",name)
continue # continue
ball = balls.get(name,{}) ball = balls.get(name,{})
# 检查 "xyxy" 键是否为 None
if ball.get("xyxy") is None:
ball["xyxy"] = []
# ball["tkid"] = int(tracker_id) # ball["tkid"] = int(tracker_id)
ball["conf"] = round(float(confidence), 2) ball["conf"] = round(float(confidence), 2)
ball["xyxy"] = [int(xyxy[0]), int(xyxy[1]), int(xyxy[2]), int(xyxy[3])] site = [int(xyxy[0]), int(xyxy[1]), int(xyxy[2]), int(xyxy[3])]
ball["xyxy"].append(site)
ball["count"] = ball.get("count",0) + 1 ball["count"] = ball.get("count",0) + 1
if region - count < 3: if region - count < 3:
ball["final"] = ball.get("final",0) + 1 ball["final"] = ball.get("final",0) + 1

Binary file not shown.

Binary file not shown.

Binary file not shown.