diff --git a/app.py b/app.py index fd885b5..c7a7078 100644 --- a/app.py +++ b/app.py @@ -126,11 +126,15 @@ def worker(id,source,region=None,stream=False): name = model.model.names[class_id] if name in names: print("Name duplicate",name) - continue + # continue ball = balls.get(name,{}) + # 检查 "xyxy" 键是否为 None + if ball.get("xyxy") is None: + ball["xyxy"] = [] # 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 diff --git a/videos/黑八1.mp4 b/videos/黑八1.mp4 index c6c4ffd..af043e3 100644 Binary files a/videos/黑八1.mp4 and b/videos/黑八1.mp4 differ diff --git a/videos/黑八2.mp4 b/videos/黑八2.mp4 index c4f59c6..0457feb 100644 Binary files a/videos/黑八2.mp4 and b/videos/黑八2.mp4 differ diff --git a/videos/黑八3.mp4 b/videos/黑八3.mp4 index 995e957..19d6550 100644 Binary files a/videos/黑八3.mp4 and b/videos/黑八3.mp4 differ