Skip to content

Commit 66bcfd5

Browse files
maximpavlivMMathisLabsneakers-the-ratarturoptophys
authored andcommitted
[WIP] Continue work on Integration with DeepLabCut 3.0 (DeepLabCut#127)
* Update benchmark.py - changed benchmarking link; needs testing * fix DeepLabCut#112 - don't subset cpuinfo (DeepLabCut#114) * Introduce CI/CD for TensorFLow version (DeepLabCut#122) * Update .gitignore * CI/CD update python version * CI/CD update actions versions * CI/CD update trigger events * CI/CD update MacOS version * dlclibrary set version to >=0.0.6 * Poetry lock * Poetry lock * Pyproject.toml update tensorflow installation * Poetry lock * Install specific tensorflow-io-gcs-filesystem for windows * Poetry lock * Update deprecated section name * Poetry lock * CI/CD test on python 3.11, 3.12, 3.13 as well * Update testing.yml - rename to main - add tables installation --------- Co-authored-by: Mackenzie Mathis <mathis@rowland.harvard.edu> * master --> main * Update testing.yml * Update benchmark.py * Update README & benchmarking script (DeepLabCut#126) * Update README.md fix test instructions * Update check_install.py * Update check_install.py * Update check_install.py * Update pyproject.toml (DeepLabCut#125) * Update pyproject.toml - adding support for python 3.11, 3.12, 3.13 * Update testing.yml * Update testing.yml * Update pyproject.toml * Update testing.yml * Update pyproject.toml * Update poetry.lock * Update poetry.lock * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update testing.yml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update testing.yml * Update pyproject.toml * Update pyproject.toml * Update poetry.lock * Update testing.yml * Update testing.yml * Update testing.yml - remove poetry (for now) * Update testing.yml * Update testing.yml * Update testing.yml * Update testing.yml * Update testing.yml * updated poetry.lock * updated * Update testing.yml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update testing.yml testing 3.11 * Update testing.yml * Update pyproject.toml * Update pyproject.toml * Update pyproject.toml * Update testing.yml * updated test for win32 * Update testing.yml * Update testing.yml * Update testing.yml * Update testing.yml * Fix download_benchmarking_data() * Ignore __MACOSX directories * Run tests on all PRs * tensorflow-io-gcs-filesystem - python=3.9 * Pin python to 3.10 version * WIP refactor benchmarking: __init__.py * WIP refactor benchmarking: remove dupplicates * WIP refactor benchmarking: warning * WIP refactor benchmarking: close live * WIP refactor benchmarking: resize and pixels * WIP refactor benchmarking: get_sys_info * Update benchmark.py (DeepLabCut#123) * WIP refactor benchmarking: Delete dupplicate scripts * WIP refactor benchmarking: Introduce Engine * WIP refactor benchmarking: benchmark() method * WIP refactor benchmarking: benchmark_videos() * CI/CD: add torch installation * WIP refactor benchmarking: extract Engine * Refactor benchmarking: model_type in benchmark_videos() * Delete poetry lock * Fix frame_batch initialization in runner.py when low detection confidence (DeepLabCut#138) --------- Co-authored-by: Mackenzie Mathis <mathis@rowland.harvard.edu> Co-authored-by: Jonny Saunders <sneakers-the-rat@protonmail.com> Co-authored-by: Artur <35294812+arturoptophys@users.noreply.github.com>
1 parent 208dd48 commit 66bcfd5

13 files changed

Lines changed: 613 additions & 1726 deletions

File tree

.github/workflows/testing.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
branches: [main]
87

98
jobs:
109
build:
@@ -25,18 +24,13 @@ jobs:
2524
- name: Checkout code
2625
uses: actions/checkout@v4
2726

28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v4
30-
with:
31-
python-version: ${{ matrix.python-version }}
32-
3327
- name: Set up Python
3428
uses: conda-incubator/setup-miniconda@v3
3529
with:
3630
channels: conda-forge,defaults
3731
channel-priority: strict
3832
python-version: ${{ matrix.python-version }}
39-
33+
4034
- name: Install ffmpeg
4135
run: |
4236
if [ "$RUNNER_OS" == "Linux" ]; then
@@ -48,8 +42,8 @@ jobs:
4842
choco install ffmpeg
4943
fi
5044
shell: bash
51-
52-
- name: Install PyTables through Conda
45+
46+
- name: Install and test
5347
shell: bash -el {0} # Important: activates the conda environment
5448
run: |
5549
conda install pytables==3.8.0 "numpy<2"
@@ -65,11 +59,10 @@ jobs:
6559
run: poetry lock --no-cache
6660

6761
- name: Install project dependencies
68-
run: poetry install --with dev
62+
run: poetry install --with dev --extras "tf" --extras "pytorch"
6963

7064
- name: Run DLC Live Tests
7165
run: poetry run dlc-live-test --nodisplay
7266

7367
- name: Run Functional Benchmark Test
7468
run: poetry run pytest tests/test_benchmark_script.py
75-

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ then use TF1.13 with DlC-Live; export with TF2.3, then use TF2.3 with DLC-live).
7777

7878
Note, you can then test your installation by installing poetry (`pip install poetry`), then running:
7979

80-
81-
8280
```python
8381
poetry run dlc-live-test
8482
```

benchmarking/run_dlclive_benchmark.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import glob
1313

1414
from dlclive import benchmark_videos, download_benchmarking_data
15+
from dlclive.engine import Engine
1516

1617
datafolder = os.path.join(
1718
pathlib.Path(__file__).parent.absolute(), "Data-DLC-live-benchmark"
@@ -36,8 +37,22 @@
3637
if not os.path.isdir(out_dir):
3738
os.mkdir(out_dir)
3839

39-
for m in dog_models:
40-
benchmark_videos(m, dog_video, output=out_dir, n_frames=n_frames, pixels=pixels)
41-
42-
for m in mouse_models:
43-
benchmark_videos(m, mouse_video, output=out_dir, n_frames=n_frames, pixels=pixels)
40+
for model_path in dog_models:
41+
benchmark_videos(
42+
model_path=model_path,
43+
model_type="base" if Engine.from_model_path(model_path) == Engine.TENSORFLOW else "pytorch",
44+
video_path=dog_video,
45+
output=out_dir,
46+
n_frames=n_frames,
47+
pixels=pixels
48+
)
49+
50+
for model_path in mouse_models:
51+
benchmark_videos(
52+
model_path=model_path,
53+
model_type="base" if Engine.from_model_path(model_path) == Engine.TENSORFLOW else "pytorch",
54+
video_path=mouse_video,
55+
output=out_dir,
56+
n_frames=n_frames,
57+
pixels=pixels
58+
)

dlclive/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
from dlclive.dlclive import DLCLive
1010
from dlclive.processor.processor import Processor
1111
from dlclive.version import VERSION, __version__
12+
from dlclive.benchmark import benchmark_videos, download_benchmarking_data

0 commit comments

Comments
 (0)