Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit eb2ab0b

Browse files
committed
test refactoring
1 parent 25c7bbb commit eb2ab0b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

tests/prepare_and_run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ green "For \"$WHEEL\""
9494
green "RUN TESTS with ./venv_t/bin/python ./tests.py"
9595
./venv_t/bin/python ./tests.py
9696
green "RUN TESTS with ./venv_t/bin/python ./speed_test.py"
97-
./venv_t/bin/ipython ./speed_test.py
97+
./venv_t/bin/python ./speed_test.py

tests/speed_test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cv2
22
import numpy as np
3-
from IPython import get_ipython
3+
import time
44

55
# prepare all stuff and do the first inference
66
# it will load all things into memory
@@ -16,4 +16,10 @@
1616
_ = net.forward()
1717

1818
# measure the inference speed
19-
get_ipython().magic("timeit _ = net.forward()")
19+
RUNS = 10
20+
times = []
21+
for _ in range(RUNS):
22+
start_time = time.time()
23+
_ = net.forward()
24+
times.append((time.time() - start_time) * 1000)
25+
print(f'Mean inference time {np.mean(times):.3f} ± {np.std(times):.3f} ms ({RUNS} runs)')

0 commit comments

Comments
 (0)