Skip to content

[WIP] Continue work on Integration with DeepLabCut 3.0 #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 36 commits into
base: dlclive3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
143f3d3
Update benchmark.py
MMathisLab Jun 13, 2025
41ee58f
fix #112 - don't subset cpuinfo (#114)
sneakers-the-rat Jun 13, 2025
662e223
Introduce CI/CD for TensorFLow version (#122)
maximpavliv Jun 13, 2025
ea8ce75
Merge branch 'main' into MMathisLab-data
MMathisLab Jun 13, 2025
36557a8
master --> main
MMathisLab Jun 13, 2025
6cae578
Merge branch 'main' into MMathisLab-data
MMathisLab Jun 13, 2025
4004ef9
Update testing.yml
MMathisLab Jun 13, 2025
f8fc8ba
Update benchmark.py
MMathisLab Jun 14, 2025
ae95d0b
Merge branch 'main' into MMathisLab-data
MMathisLab Jun 14, 2025
88038ac
Update README & benchmarking script (#126)
MMathisLab Jun 14, 2025
3b88f25
Merge branch 'main' into MMathisLab-data
MMathisLab Jun 14, 2025
a74101f
Update pyproject.toml (#125)
MMathisLab Jun 15, 2025
0883c17
Merge branch 'main' into MMathisLab-data
MMathisLab Jun 15, 2025
6c61b29
Fix download_benchmarking_data()
maximpavliv Jun 16, 2025
ef37746
Ignore __MACOSX directories
maximpavliv Jun 16, 2025
2a4f4af
Merge branch 'main' into maxim/dlclive3
maximpavliv Jun 16, 2025
ad14faa
Run tests on all PRs
maximpavliv Jun 16, 2025
d882b6b
tensorflow-io-gcs-filesystem - python=3.9
maximpavliv Jun 16, 2025
7599121
Pin python to 3.10 version
maximpavliv Jun 16, 2025
7593c87
Merge branch 'MMathisLab-data' into maxim/dlclive3
maximpavliv Jun 16, 2025
199adc0
WIP refactor benchmarking: __init__.py
maximpavliv Jun 16, 2025
e86db2d
WIP refactor benchmarking: remove dupplicates
maximpavliv Jun 16, 2025
0d6b2d5
WIP refactor benchmarking: warning
maximpavliv Jun 16, 2025
6402380
WIP refactor benchmarking: close live
maximpavliv Jun 16, 2025
f013557
WIP refactor benchmarking: resize and pixels
maximpavliv Jun 16, 2025
39c27f6
WIP refactor benchmarking: get_sys_info
maximpavliv Jun 16, 2025
44c960f
Update benchmark.py (#123)
MMathisLab Jun 16, 2025
f2c6b11
WIP refactor benchmarking: Delete dupplicate scripts
maximpavliv Jun 17, 2025
bc036a7
WIP refactor benchmarking: Introduce Engine
maximpavliv Jun 17, 2025
4bbcf7c
WIP refactor benchmarking: benchmark() method
maximpavliv Jun 17, 2025
8366187
WIP refactor benchmarking: benchmark_videos()
maximpavliv Jun 17, 2025
db6a61d
CI/CD: add torch installation
maximpavliv Jun 17, 2025
664835c
WIP refactor benchmarking: extract Engine
maximpavliv Jun 17, 2025
4475ea2
Refactor benchmarking: model_type in benchmark_videos()
maximpavliv Jun 17, 2025
e994808
Merge branch 'main' into maxim/dlclive3
maximpavliv Jun 17, 2025
5731ebe
Delete poetry lock
maximpavliv Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: Python package

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]


jobs:
Expand Down
36 changes: 31 additions & 5 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: Run Tests

on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]

jobs:
build:
Expand All @@ -31,6 +30,14 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up Python
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge,defaults
channel-priority: strict
python-version: ${{ matrix.python-version }}

- name: Install ffmpeg
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
Expand All @@ -42,8 +49,27 @@ jobs:
choco install ffmpeg
fi
shell: bash

- name: Install and test
shell: bash -el {0} # Important: activates the conda environment
run: |
python -m pip install --upgrade pip wheel poetry
python -m poetry install --extras "tf"
python -m poetry run dlc-live-test --nodisplay
conda install pytables==3.8.0 "numpy<2"

- name: Install dependencies via Conda
shell: bash -el {0}
run: conda install -y "numpy>=1.26,<2.0"

- name: Install Poetry
run: pip install --upgrade pip wheel poetry

- name: Regenerate Poetry lock
run: poetry lock --no-cache

- name: Install project dependencies
run: poetry install --with dev --extras "tf" --extras "pytorch"

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

- name: Run Functional Benchmark Test
run: poetry run pytest tests/test_benchmark_script.py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ benchmarking/results*
**DS_Store*
*vscode*

**/__MACOSX/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ same version (i.e., export a PyTorch model, then install PyTorch, export with TF
then use TF1.13 with DlC-Live; export with TF2.3, then use TF2.3 with DLC-live).

- available on pypi as: `pip install deeplabcut-live`


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

`dlc-live-test`
```python
poetry run dlc-live-test
```

If installed properly, this script will i) create a temporary folder ii) download the
full_dog model from the [DeepLabCut Model Zoo](
Expand Down
25 changes: 20 additions & 5 deletions benchmarking/run_dlclive_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import glob

from dlclive import benchmark_videos, download_benchmarking_data
from dlclive.engine import Engine

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

for m in dog_models:
benchmark_videos(m, dog_video, output=out_dir, n_frames=n_frames, pixels=pixels)

for m in mouse_models:
benchmark_videos(m, mouse_video, output=out_dir, n_frames=n_frames, pixels=pixels)
for model_path in dog_models:
benchmark_videos(
model_path=model_path,
model_type="base" if Engine.from_model_path(model_path) == Engine.TENSORFLOW else "pytorch",
video_path=dog_video,
output=out_dir,
n_frames=n_frames,
pixels=pixels
)

for model_path in mouse_models:
benchmark_videos(
model_path=model_path,
model_type="base" if Engine.from_model_path(model_path) == Engine.TENSORFLOW else "pytorch",
video_path=mouse_video,
output=out_dir,
n_frames=n_frames,
pixels=pixels
)
1 change: 1 addition & 0 deletions dlclive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
from dlclive.dlclive import DLCLive
from dlclive.processor.processor import Processor
from dlclive.version import VERSION, __version__
from dlclive.benchmark import benchmark_videos, download_benchmarking_data
Loading
Loading