Skip to content

Commit 5ed1910

Browse files
authored
pytest for benchmarking
1 parent ef37746 commit 5ed1910

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_benchmark_script.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import os
2+
import glob
3+
import pathlib
4+
import pytest
5+
from dlclive import benchmark_videos, download_benchmarking_data
6+
7+
@pytest.mark.functional
8+
def test_benchmark_script_runs(tmp_path):
9+
datafolder = tmp_path / "Data-DLC-live-benchmark"
10+
download_benchmarking_data(str(datafolder))
11+
12+
dog_models = glob.glob(str(datafolder / "dog" / "*[!avi]"))
13+
dog_video = glob.glob(str(datafolder / "dog" / "*.avi"))[0]
14+
mouse_models = glob.glob(str(datafolder / "mouse_lick" / "*[!avi]"))
15+
mouse_video = glob.glob(str(datafolder / "mouse_lick" / "*.avi"))[0]
16+
17+
out_dir = tmp_path / "results"
18+
out_dir.mkdir(exist_ok=True)
19+
20+
pixels = [2500, 10000]
21+
n_frames = 10
22+
23+
for m in dog_models:
24+
benchmark_videos(m, dog_video, output=str(out_dir), n_frames=n_frames, pixels=pixels)
25+
26+
for m in mouse_models:
27+
benchmark_videos(m, mouse_video, output=str(out_dir), n_frames=n_frames, pixels=pixels)
28+
29+
assert any(out_dir.iterdir())

0 commit comments

Comments
 (0)