Skip to content

Commit 09116e3

Browse files
committed
Merge branch 'main' into maxim/dlclive3
2 parents 4475ea2 + 44c960f commit 09116e3

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

.github/workflows/testing.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ jobs:
5353
- name: Install and test
5454
shell: bash -el {0} # Important: activates the conda environment
5555
run: |
56-
python -m pip install --upgrade pip wheel poetry
57-
python -m poetry install --extras "tf" --extras "pytorch"
58-
python -m poetry run dlc-live-test --nodisplay
56+
conda install pytables==3.8.0 "numpy<2"
57+
58+
- name: Install dependencies via Conda
59+
shell: bash -el {0}
60+
run: conda install -y "numpy>=1.26,<2.0"
61+
62+
- name: Install Poetry
63+
run: pip install --upgrade pip wheel poetry
64+
65+
- name: Regenerate Poetry lock
66+
run: poetry lock --no-cache
67+
68+
- name: Install project dependencies
69+
run: poetry install --with dev --extras "tf" --extras "pytorch"
70+
71+
- name: Run DLC Live Tests
72+
run: poetry run dlc-live-test --nodisplay
73+
74+
- name: Run Functional Benchmark Test
75+
run: poetry run pytest tests/test_benchmark_script.py

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ py-cpuinfo = ">=5.0.0"
3535
tqdm = "^4.62.3"
3636
pandas = ">=1.0.1,!=1.5.0"
3737
tables = "^3.8"
38+
pytest = "^8.0"
3839
dlclibrary = ">=0.0.6"
40+
3941
# PyTorch models
4042
scipy = ">=1.9"
4143
timm = { version = ">=1.0.7", optional = true }

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
markers =
3+
functional: functional tests

tests/test_benchmark_script.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 = [100, 400] #[2500, 10000]
21+
n_frames = 5
22+
23+
for m in dog_models:
24+
print(f"Running dog model: {m}")
25+
result = benchmark_videos(m, dog_video, output=str(out_dir), n_frames=n_frames, pixels=pixels)
26+
print("Dog model result:", result)
27+
28+
for m in mouse_models:
29+
print(f"Running mouse model: {m}")
30+
result = benchmark_videos(m, mouse_video, output=str(out_dir), n_frames=n_frames, pixels=pixels)
31+
print("Mouse model result:", result)
32+
33+
assert any(out_dir.iterdir())

0 commit comments

Comments
 (0)