Add object detection, tracking, mobile notifications, and search to any security camera.
count ppl in test
roryclear142f5e5b4010
diff --git a/test/test_mot.py b/test/test_mot.pyindex d62f1f3..2001d9d 100644--- a/test/test_mot.py+++ b/test/test_mot.py@@ -55,6 +55,7 @@ if __name__ == "__main__":class_labels = fetch('https://raw.githubusercontent.com/pjreddie/darknet/master/data/coco.names').read_text().split("\n")Path('./outputs').mkdir(parents=True, exist_ok=True)i = 0+ ppl = set()while True:ret, im0 = cap.read()if not ret: break@@ -69,15 +70,19 @@ if __name__ == "__main__":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 oc_online_targets:+ if x[6] == 0 and x[4] not in ppl: ppl.add(x[4])+ preds.append(np.array([x[0], x[1], x[2], x[3], x[4], x[6]]))++ #preds = []+ #for x in online_targets:+ # if x.class_id == 0 and x.track_id not in ppl: ppl.add(x.track_id)+ # 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")-+ print("ppl =",len(ppl))#pred = pred[pred[:, 4] >= 0.25]_, buffer = cv2.imencode(".jpg", im0)out.write(draw_bounding_boxes(buffer, preds, class_labels))