Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

687 B
Raw Blame
import pickle
from ocsort_tracker import ocsort
import numpy as np
import time
ocs_tracker = ocsort.OCSort(max_age=60)
tracks = pickle.load(open('test/tracks.pkl', 'rb'))

st = time.time()
for i in range(len(tracks)):
    out = ocs_tracker.update(tracks[i][0], 0.25)
    preds = []
    expected = []
    for x in out: 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]))
    for x in tracks[i][1]: expected.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]))
    np.testing.assert_allclose(preds, expected, rtol=1e-5)
print(f"passed in {(time.time() - st):.2f} seconds")