From 46e7a6560e5f43122c67fb69bed3a87f4dce5fc5 Mon Sep 17 00:00:00 2001 From: luanhailiang Date: Sat, 7 Oct 2023 18:56:28 +0800 Subject: [PATCH] tracker_id --- app.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index 7ea6d05..a738cb3 100644 --- a/app.py +++ b/app.py @@ -109,23 +109,23 @@ def worker(id,source,region=None,stream=False): del(frame) result = result[0] detections = sv.Detections.from_yolov8(result) - if result.boxes.id is not None: - detections.tracker_id = result.boxes.id.cpu().numpy().astype(int) - else: - detections.tracker_id = np.array([]) - detections.conf = np.array([]) - detections.xyxy=np.empty((0, 4), dtype=np.float32) + # if result.boxes.id is not None: + # detections.tracker_id = result.boxes.id.cpu().numpy().astype(int) + # else: + # detections.tracker_id = np.array([]) + # detections.conf = np.array([]) + # detections.xyxy=np.empty((0, 4), dtype=np.float32) # detections = detections[(detections.tracker_id != None)] count += 1 names = {} - for xyxy,_, confidence, class_id, tracker_id in detections: + for xyxy,_, confidence, class_id in detections: name = model.model.names[class_id] if name in names: print("Name duplicate",name) continue ball = balls.get(name,{}) - ball["tkid"] = int(tracker_id) + # 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])] ball["count"] = ball.get("count",0) + 1