Compare commits

..

2 Commits

1 changed files with 5 additions and 1 deletions

6
app.py
View File

@ -122,6 +122,9 @@ def worker(id,source,region=None,stream=False):
count += 1
names = {}
# 检查 "xyxy" 键是否为 None
if ball.get("xyxy") is None:
ball["xyxy"] = []
for xyxy,_, confidence, class_id,tracker_id in detections:
name = model.model.names[class_id]
if name in names:
@ -130,7 +133,8 @@ def worker(id,source,region=None,stream=False):
ball = balls.get(name,{})
# ball["tkid"] = int(tracker_id)
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
if region - count < 3:
ball["final"] = ball.get("final",0) + 1