Neural network backend for training and inference for animal pose estimation.
This is the deep learning engine that powers SLEAP (Social LEAP Estimates Animal Poses), providing neural network architectures for multi-instance animal pose estimation and tracking. Built on PyTorch, SLEAP-NN offers an end-to-end training workflow, supporting multiple model types (Single Instance, Top-Down, Bottom-Up, Multi-Class), and seamless integration with SLEAP's GUI and command-line tools.
Need a quick start? Refer to our Quick Start guide in the docs.
📚 Documentation - Comprehensive guides and API reference
- Clone the sleap-nn repo
git clone https://github.com/talmolab/sleap-nn.git
cd sleap-nn
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
- Install sleap-nn dependencies based on your platform\
Python 3.14 is not yet supported
sleap-nn
currently supports Python 3.11, 3.12, and 3.13.
Python 3.14 is not yet tested or supported.
By default,uv
will use your system-installed Python.
If you have Python 3.14 installed, you must specify the Python version (≤3.13) in the install command.For example:
uv sync --python 3.13 ...Replace
...
with the rest of your install command as needed.
-
Sync all dependencies based on your correct wheel using
uv sync
.uv sync
creates a.venv
(virtual environment) inside your current working directory. This environment is only active within that directory and can't be directly accessed from outside. To use all installed packages, you must run commands withuv run
(e.g.,uv run sleap-nn train ...
oruv run pytest ...
).- Windows/Linux with NVIDIA GPU (CUDA 11.8):
uv sync --extra dev --extra torch-cuda118
- Windows/Linux with NVIDIA GPU (CUDA 12.8):
uv sync --extra dev --extra torch-cuda128
- macOS with Apple Silicon (M1, M2, M3, M4) or CPU-only (no GPU or unsupported GPU): Note: Even if torch-cpu is used on macOS, the MPS backend will be available.
uv sync --extra dev --extra torch-cpu
-
Run tests
uv run pytest tests
-
(Optional) Lint and format code
uv run black --check sleap_nn tests uv run ruff check sleap_nn/
Upgrading All Dependencies To ensure you have the latest versions of all dependencies, use the
--upgrade
flag withuv sync
:uv sync --extra dev --upgradeThis will upgrade all installed packages in your environment to the latest available versions compatible with your
pyproject.toml
.