Skip to content

Quick Start

Train a model and run inference in under 5 minutes.


Installation

uv tool install sleap-nn --torch-backend auto

See full installation guide for other methods and troubleshooting.


Prerequisites

  • A training dataset (.slp or .pkg.slp file)

Sample Data

Download sample data to try it out:


Step 1: Create a Config File

Create config.yaml:

config.yaml
data_config:
  train_labels_path:
    - train.pkg.slp
  val_labels_path:
    - val.pkg.slp

model_config:
  backbone_config:
    unet:
      filters: 32
      max_stride: 16
  head_configs:
    single_instance:
      confmaps:
        sigma: 5.0

trainer_config:
  max_epochs: 50
  save_ckpt: true
  ckpt_dir: models
  run_name: my_first_model

Or grab a sample config for your model type.


Step 2: Train

sleap-nn train --config config.yaml

That's it! Training will:

  1. Load your data
  2. Build the model
  3. Train for 50 epochs
  4. Save the best checkpoint to models/my_first_model/

Step 3: Run Inference

sleap-nn predict --data_path val.pkg.slp --model_paths models/my_first_model/ -o val.predictions.slp

This creates val.predictions.slp with your predictions.


Step 4: View Results

Open the predictions in the SLEAP GUI:

sleap-label val.predictions.slp

Or load in Python:

import sleap_io as sio

labels = sio.load_slp("val.predictions.slp")
print(f"Found {len(labels)} frames with predictions")

What's Next?