sleap-nn


Namesleap-nn JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryNeural network backend for training and inference for animal pose estimation.
upload_time2025-08-21 01:31:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseBSD-3-Clause
keywords sleap pose estimation deep learning neural networks computer vision animal behavior
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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/)

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.

## Documentation

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

## Installation

**Prerequisites: Python 3.11**

### From PyPI

- **Windows/Linux with NVIDIA GPU (CUDA 11.8):**

```bash
pip install sleap-nn[torch-cuda118]
```

- **Windows/Linux with NVIDIA GPU (CUDA 12.8):**

```bash
pip install sleap-nn[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.
```bash
pip install sleap-nn[torch-cpu]
```


### 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) and development dependencies**  
   `uv` is a fast and modern package manager for `pyproject.toml`-based projects. Refer [installation docs](https://docs.astral.sh/uv/getting-started/installation/) to install uv.

3. **Install sleap-nn dependencies based on your platform**\

   - Sync all dependencies based on your correct wheel using `uv sync`:
     - **Windows/Linux with NVIDIA GPU (CUDA 11.8):**

      ```bash
      uv sync --extra dev --extra torch-cuda118
      ```

      - **Windows/Linux with NVIDIA GPU (CUDA 12.8):**

      ```bash
      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.
     ```bash
      uv sync --extra dev --extra torch-cpu
      ```

   You can find the correct wheel for your system at:\
   👉 [https://pytorch.org/get-started/locally](https://pytorch.org/get-started/locally)

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/
   ```

## Quick Start

Let's start SLEAPiNNg !!! 🐭🐭

> For detailed information on setting up config, training/ inference workflows, please refer to our [docs](https://nn.sleap.ai).

#### 1. Set Up Your Configuration

Create a `config.yaml` file for your experiment.

> Use a sample config from [`docs/sample_configs`](https://github.com/talmolab/sleap-nn/tree/main/docs/sample_configs).

#### 2. Train a model

> Download sample training data from [here](https://storage.googleapis.com/sleap-data/datasets/BermanFlies/random_split1/train.pkg.slp) and validation data from [here](https://storage.googleapis.com/sleap-data/datasets/BermanFlies/random_split1/val.pkg.slp) for quick experimentation.

```bash
sleap-nn-train --config-name config.yaml --config-dir configs/ "data_config.train_labels_path=[labels.pkg.slp]"
```

#### 3. Run inference on the trained model

To run inference:
```bash
sleap-nn-track --data-path video.mp4 --model-paths model_ckpt_dir/
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sleap-nn",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "sleap, pose estimation, deep learning, neural networks, computer vision, animal behavior",
    "author": null,
    "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>",
    "download_url": "https://files.pythonhosted.org/packages/f3/0a/6f79ffe9380c2d64773246f9f59fe5324ddb00decfa9b8f4377a97ff1cfc/sleap_nn-0.0.1.tar.gz",
    "platform": null,
    "description": "# sleap-nn\n\n[![CI](https://github.com/talmolab/sleap-nn/actions/workflows/ci.yml/badge.svg)](https://github.com/talmolab/sleap-nn/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/talmolab/sleap-nn/branch/main/graph/badge.svg?token=Sj8kIFl3pi)](https://codecov.io/gh/talmolab/sleap-nn)\n[![Release](https://img.shields.io/github/v/release/talmolab/sleap-nn?label=Latest)](https://github.com/talmolab/sleap-nn/releases/)\n\nNeural network backend for training and inference for animal pose estimation.\n\nThis 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.\n\n## Documentation\n\n**\ud83d\udcda [Documentation](https://nn.sleap.ai)** - Comprehensive guides and API reference\n\n## Installation\n\n**Prerequisites: Python 3.11**\n\n### From PyPI\n\n- **Windows/Linux with NVIDIA GPU (CUDA 11.8):**\n\n```bash\npip install sleap-nn[torch-cuda118]\n```\n\n- **Windows/Linux with NVIDIA GPU (CUDA 12.8):**\n\n```bash\npip install sleap-nn[torch-cuda128]\n```\n\n- **macOS with Apple Silicon (M1, M2, M3, M4) or CPU-only (no GPU or unsupported GPU):** \nNote: Even if torch-cpu is used on macOS, the MPS backend will be available.\n```bash\npip install sleap-nn[torch-cpu]\n```\n\n\n### For development setup\n\n1. **Clone the sleap-nn repo**\n\n```bash\ngit clone https://github.com/talmolab/sleap-nn.git\ncd sleap-nn\n```\n\n2. **Install [`uv`](https://github.com/astral-sh/uv) and development dependencies**  \n   `uv` is a fast and modern package manager for `pyproject.toml`-based projects. Refer [installation docs](https://docs.astral.sh/uv/getting-started/installation/) to install uv.\n\n3. **Install sleap-nn dependencies based on your platform**\\\n\n   - Sync all dependencies based on your correct wheel using `uv sync`:\n     - **Windows/Linux with NVIDIA GPU (CUDA 11.8):**\n\n      ```bash\n      uv sync --extra dev --extra torch-cuda118\n      ```\n\n      - **Windows/Linux with NVIDIA GPU (CUDA 12.8):**\n\n      ```bash\n      uv sync --extra dev --extra torch-cuda128\n      ```\n     \n     - **macOS with Apple Silicon (M1, M2, M3, M4) or CPU-only (no GPU or unsupported GPU):** \n     Note: Even if torch-cpu is used on macOS, the MPS backend will be available.\n     ```bash\n      uv sync --extra dev --extra torch-cpu\n      ```\n\n   You can find the correct wheel for your system at:\\\n   \ud83d\udc49 [https://pytorch.org/get-started/locally](https://pytorch.org/get-started/locally)\n\n4. **Run tests**  \n   ```bash\n   uv run pytest tests\n   ```\n\n5. **(Optional) Lint and format code**\n   ```bash\n   uv run black --check sleap_nn tests\n   uv run ruff check sleap_nn/\n   ```\n\n## Quick Start\n\nLet's start SLEAPiNNg !!! \ud83d\udc2d\ud83d\udc2d\n\n> For detailed information on setting up config, training/ inference workflows, please refer to our [docs](https://nn.sleap.ai).\n\n#### 1. Set Up Your Configuration\n\nCreate a `config.yaml` file for your experiment.\n\n> Use a sample config from [`docs/sample_configs`](https://github.com/talmolab/sleap-nn/tree/main/docs/sample_configs).\n\n#### 2. Train a model\n\n> Download sample training data from [here](https://storage.googleapis.com/sleap-data/datasets/BermanFlies/random_split1/train.pkg.slp) and validation data from [here](https://storage.googleapis.com/sleap-data/datasets/BermanFlies/random_split1/val.pkg.slp) for quick experimentation.\n\n```bash\nsleap-nn-train --config-name config.yaml --config-dir configs/ \"data_config.train_labels_path=[labels.pkg.slp]\"\n```\n\n#### 3. Run inference on the trained model\n\nTo run inference:\n```bash\nsleap-nn-track --data-path video.mp4 --model-paths model_ckpt_dir/\n```\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Neural network backend for training and inference for animal pose estimation.",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://sleap.ai",
        "Repository": "https://github.com/talmolab/sleap-nn"
    },
    "split_keywords": [
        "sleap",
        " pose estimation",
        " deep learning",
        " neural networks",
        " computer vision",
        " animal behavior"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "705d00a06cb81af41c40f524fa03aff446366a9dcec247da89684b9da3fbd21c",
                "md5": "e85f29aefd14a90e1d81edf5c8d0ed79",
                "sha256": "c385aa636a1703a50792e8a20d2f7970fd873cc997401b6a459fb6746b40caba"
            },
            "downloads": -1,
            "filename": "sleap_nn-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e85f29aefd14a90e1d81edf5c8d0ed79",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 216461,
            "upload_time": "2025-08-21T01:30:59",
            "upload_time_iso_8601": "2025-08-21T01:30:59.645476Z",
            "url": "https://files.pythonhosted.org/packages/70/5d/00a06cb81af41c40f524fa03aff446366a9dcec247da89684b9da3fbd21c/sleap_nn-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f30a6f79ffe9380c2d64773246f9f59fe5324ddb00decfa9b8f4377a97ff1cfc",
                "md5": "331554124917ff1c283ea31d5218a828",
                "sha256": "c3497ac962d3153fc262b0e0b4bf42658728ef8df983b6cc678b6f2ccc0057de"
            },
            "downloads": -1,
            "filename": "sleap_nn-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "331554124917ff1c283ea31d5218a828",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 13833787,
            "upload_time": "2025-08-21T01:31:01",
            "upload_time_iso_8601": "2025-08-21T01:31:01.600460Z",
            "url": "https://files.pythonhosted.org/packages/f3/0a/6f79ffe9380c2d64773246f9f59fe5324ddb00decfa9b8f4377a97ff1cfc/sleap_nn-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-21 01:31:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "talmolab",
    "github_project": "sleap-nn",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sleap-nn"
}
        
Elapsed time: 0.62838s