forked from scikit-video/scikit-video
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbench_motion.py
62 lines (50 loc) · 1.78 KB
/
bench_motion.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""
=======================
Block Motion Estimation benchmark
=======================
Benchmark using the block motion estimation routines included in skvideo.
Output for sequence of size (120, 144, 176, 3)
Performance on block motion algorithms using skvideo.motion.blockMotion:
------------------------------------------------------------
exhaustive 43.946715 seconds
3-step search 17.558664 seconds
"new" 3-step search 32.340459 seconds
Simple and Efficient 3-step search 13.861776 seconds
4-step search 36.315580 seconds
Adaptive Rood Pattern search 21.413136 seconds
Diamond search 25.679036 seconds
"""
# Author: Todd Goodall <[email protected]>
# License: BSD clause
from time import time
import skvideo.motion
if __name__ == "__main__":
# TODO: as code gets faster, make benchmark more
# rigorous
# for time, use small pristine video
vidname = skvideo.datasets.fullreferencepair()[0]
vdata = skvideo.io.vread(vidname)
# first 2 frames
estimator_titles = ["exhaustive",
"3-step search",
"\"new\" 3-step search",
"Simple and Efficient 3-step search",
"4-step search",
"Adaptive Rood Pattern search",
"Diamond search",
]
estimators = ["ES", "3SS", "N3SS", "SE3SS", "4SS", "ARPS", "DS"]
times = []
for es in estimators:
print(es)
time_start = time()
skvideo.motion.blockMotion(vdata, method=es)
time_end = time()
times.append(time_end - time_start)
print("")
print(vdata.shape)
print("Performance on block motion algorithms using skvideo.motion.blockMotion:")
print("-" * 60)
for (title, time) in zip(estimator_titles, times):
print("%s %f seconds" % (title.ljust(35), time))
print("")