From 53400530b32409385457975ee40dc71fb7faab52 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Mon, 8 May 2023 20:59:35 +0200 Subject: [PATCH] Start with tracking --- predict_path.ipynb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/predict_path.ipynb b/predict_path.ipynb index 5b539ff..5184462 100644 --- a/predict_path.ipynb +++ b/predict_path.ipynb @@ -455,6 +455,14 @@ " # alternatively look at Soft-NMS https://towardsdatascience.com/non-maximum-suppression-nms-93ce178e177c\n", "\n", " labels = [weights.meta[\"categories\"][i] for i in labels]\n", + " \n", + " # dets - a numpy array of detections in the format [[x1,y1,x2,y2,score],[x1,y1,x2,y2,score],...]\n", + " detections = [np.append(bbox, score) for bbox, score in zip(boxes, scores)]\n", + " tracks = mot_tracker.update(detections)\n", + "\n", + " # now convert back to boxes and labels\n", + " boxes = [t[:4] for t in tracks]\n", + " labels = [t[-1] for t in tracks]\n", "\n", " box = draw_bounding_boxes(t, boxes=boxes,\n", " labels=labels,\n",