Metadata-Version: 2.4
Name: sleap-nn
Version: 0.3.0
Summary: Neural network backend for training and inference for animal pose estimation.
Author-email: Divya Seshadri Murali <dimurali@salk.edu>, Elizabeth Berrigan <eberrigan@salk.edu>, Vincent Tu <vitu@ucsd.edu>, Liezl Maree <lmaree@salk.edu>, David Samy <davidasamy@gmail.com>, Talmo Pereira <talmo@salk.edu>
License: BSD-3-Clause
Project-URL: Homepage, https://sleap.ai
Project-URL: Repository, https://github.com/talmolab/sleap-nn
Keywords: sleap,pose estimation,deep learning,neural networks,computer vision,animal behavior
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: <3.14,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sleap-io<0.9.0,>=0.8.0
Requires-Dist: numpy
Requires-Dist: torch
Requires-Dist: torchvision>=0.20.0
Requires-Dist: lightning
Requires-Dist: skia-python<=138.0,>=87.0
Requires-Dist: jsonpickle
Requires-Dist: scipy
Requires-Dist: attrs
Requires-Dist: omegaconf
Requires-Dist: wandb
Requires-Dist: matplotlib
Requires-Dist: seaborn
Requires-Dist: rich
Requires-Dist: textual>=0.40.0
Requires-Dist: loguru
Requires-Dist: psutil
Requires-Dist: opencv-python
Requires-Dist: hydra-core
Requires-Dist: jupyter
Requires-Dist: jupyterlab
Requires-Dist: pyzmq
Requires-Dist: rich-click>=1.9.5
Requires-Dist: pykalman>=0.11.0
Provides-Extra: torch
Requires-Dist: torch; extra == "torch"
Requires-Dist: torchvision>=0.20.0; extra == "torch"
Provides-Extra: cpu
Requires-Dist: torch; extra == "cpu"
Requires-Dist: torchvision>=0.20.0; extra == "cpu"
Provides-Extra: gpu
Requires-Dist: torch; extra == "gpu"
Requires-Dist: torchvision>=0.20.0; extra == "gpu"
Provides-Extra: torch-cpu
Requires-Dist: torch; extra == "torch-cpu"
Requires-Dist: torchvision>=0.20.0; extra == "torch-cpu"
Provides-Extra: torch-cuda118
Requires-Dist: torch; extra == "torch-cuda118"
Requires-Dist: torchvision>=0.20.0; extra == "torch-cuda118"
Provides-Extra: torch-cuda128
Requires-Dist: torch; extra == "torch-cuda128"
Requires-Dist: torchvision>=0.20.0; extra == "torch-cuda128"
Provides-Extra: torch-cuda130
Requires-Dist: torch; extra == "torch-cuda130"
Requires-Dist: torchvision>=0.20.0; extra == "torch-cuda130"
Provides-Extra: export
Requires-Dist: onnx>=1.15.0; extra == "export"
Requires-Dist: onnxruntime>=1.16.0; extra == "export"
Requires-Dist: onnxscript>=0.1.0; extra == "export"
Provides-Extra: export-gpu
Requires-Dist: onnx>=1.15.0; extra == "export-gpu"
Requires-Dist: onnxruntime-gpu>=1.16.0; ((sys_platform == "linux" and platform_machine == "x86_64") or (sys_platform == "win32" and platform_machine == "AMD64")) and extra == "export-gpu"
Requires-Dist: onnxscript>=0.1.0; extra == "export-gpu"
Provides-Extra: tensorrt
Requires-Dist: tensorrt>=10.13.0; (sys_platform == "linux" or sys_platform == "win32") and extra == "tensorrt"
Requires-Dist: torch-tensorrt>=2.5.0; (sys_platform == "linux" or sys_platform == "win32") and extra == "tensorrt"
Provides-Extra: sam
Requires-Dist: segment-anything>=1.0; extra == "sam"
Provides-Extra: sam3
Requires-Dist: transformers>=5.0; extra == "sam3"
Dynamic: license-file

# sleap-nn

[![CI](https://github.com/talmolab/sleap-nn/actions/workflows/ci.yml/badge.svg)](https://github.com/talmolab/sleap-nn/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/talmolab/sleap-nn/branch/main/graph/badge.svg?token=Sj8kIFl3pi)](https://codecov.io/gh/talmolab/sleap-nn)
[![Release](https://img.shields.io/github/v/release/talmolab/sleap-nn?label=Latest)](https://github.com/talmolab/sleap-nn/releases/)
[![PyPI](https://img.shields.io/pypi/v/sleap-nn?label=PyPI)](https://pypi.org/project/sleap-nn)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sleap-nn)

Neural network backend for training and inference for animal pose estimation.

This is the deep learning engine that powers [SLEAP](https://sleap.ai) (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](https://nn.sleap.ai/latest/#quick-start) in the docs.

## Documentation

**[Documentation](https://nn.sleap.ai)** - Comprehensive guides and API reference

## For development setup

1. **Clone the sleap-nn repo**

```bash
git clone https://github.com/talmolab/sleap-nn.git
cd sleap-nn
```

2. **Install [`uv`](https://github.com/astral-sh/uv)**
Install [`uv`](https://github.com/astral-sh/uv) first - a fast Python package manager:
```bash
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```


3. **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:
>
> ```bash
> uv sync --python 3.13 ...
> ```
> Replace `...` with the rest of your install command as needed.

- Install everything with a single command. `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 installed packages, run commands with `uv run` (e.g., `uv run sleap-nn train ...` or `uv run pytest ...`).

   ```bash
   uv sync
   ```

   This installs the CUDA 13.0 GPU build on Windows/Linux (x86-64) and the Apple-MPS build on macOS automatically, and `uv run` keeps it. A GPU is not required — the CUDA wheel also runs on CPU.

   > <sub>Want the smaller CPU-only wheel (CPU-only machines/CI, Linux aarch64) or a specific CUDA version? Add `--no-group gpu`, e.g. `uv sync --no-group gpu --extra cpu` or `uv sync --no-group gpu --extra torch-cuda128`.</sub>

4. **Run tests**
   ```bash
   uv run pytest tests
   ```

5. **(Optional) Lint and format code**
   ```bash
   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 with `uv sync`:
> ```bash
> uv sync --upgrade
> ```
> This will upgrade all installed packages in your environment to the latest available versions compatible with your `pyproject.toml`.
