-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathsort_iou_bench.py
More file actions
34 lines (27 loc) · 987 Bytes
/
Copy pathsort_iou_bench.py
File metadata and controls
34 lines (27 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from similari import Sort, BoundingBox, SpatioTemporalConstraints, PositionalMetricType
import timeit
if __name__ == '__main__':
# all train
def bench(n):
dets = []
for i in range(n):
dets.append((BoundingBox(1000 * i, 1000 * i, 50, 60).as_xyaah(), None))
shards = 4
if n <= 100:
shards = 1
elif n <= 200:
shards = 2
constraints = SpatioTemporalConstraints()
constraints.add_constraints([(1, 1.0)])
mot_tracker = Sort(shards=shards, bbox_history=1, max_idle_epochs=10,
method=PositionalMetricType.iou(threshold=0.3),
spatio_temporal_constraints=constraints)
count = 100
duration = timeit.timeit(lambda: mot_tracker.predict(dets), number=count)
print("Run for {} took {} ms".format(n, duration / float(count) * 1000.0))
bench(10)
bench(100)
bench(200)
bench(300)
bench(500)
bench(1000)