Add object detection, tracking, mobile notifications, and search to any security camera.
both trackers in test
roryclearbe3df8ec8b8a
diff --git a/detection/yolov9.py b/detection/yolov9.pyindex e960f75..ae97b21 100644--- a/detection/yolov9.py+++ b/detection/yolov9.py@@ -479,7 +479,10 @@ def draw_bounding_boxes(orig_img_path, predictions, class_labels):object_count = defaultdict(int)for pred in predictions:- x1, y1, x2, y2, conf, class_id, _ = pred+ if len(pred) == 7: # todo+ x1, y1, x2, y2, conf, class_id, _ = pred+ else:+ x1, y1, x2, y2, conf, class_id = predif conf == 0:continuediff --git a/test/test_mot.py b/test/test_mot.pyindex 6b2c253..d62f1f3 100644--- a/test/test_mot.py+++ b/test/test_mot.py@@ -36,12 +36,14 @@ def letterbox(im, new_shape=(1280, 1280), color=(114, 114, 114), auto=True, scalif __name__ == "__main__":from yolox.tracker.byte_tracker import BYTETracker+ from yolox.ocsort_tracker import ocsortclass Args:def __init__(self):self.track_buffer = 60 # frames, was 30self.mot20 = Falseself.match_thresh = 0.9tracker = BYTETracker(Args())+ ocs_tracker = ocsort.OCSort(det_thresh=0.25)size = "t"model = YOLOv9(*SIZES[size]) if size in SIZES else YOLOv9()@@ -65,9 +67,17 @@ if __name__ == "__main__":im = im[None]pred = do_inf(im, model).numpy()[0]online_targets = tracker.update(pred, [960,960], [960,960], 0.25)+ oc_online_targets = ocs_tracker.update(pred, [960,960], [960,960])++ #preds = []+ #for x in oc_online_targets: preds.append(np.array([x[0], x[1], x[2], x[3], x[4], x[6]]))+preds = []- for x in online_targets:- preds.append(np.array([x.tlwh[0],x.tlwh[1],(x.tlwh[0]+x.tlwh[2]),(x.tlwh[1]+x.tlwh[3]),x.score,x.class_id,x.track_id]))+ for x in online_targets: preds.append(np.array([x.tlwh[0],x.tlwh[1],(x.tlwh[0]+x.tlwh[2]),(x.tlwh[1]+x.tlwh[3]),x.score,x.class_id,x.track_id]))++ print(oc_online_targets,"\n\n",preds)+ print("\n\n\n\n\n\n\n\n\n")+#pred = pred[pred[:, 4] >= 0.25]_, buffer = cv2.imencode(".jpg", im0)out.write(draw_bounding_boxes(buffer, preds, class_labels))