Skip to content

inference

sleap_nn.inference

Inference-related modules.

Quick start::

from sleap_nn.inference import predict, Predictor

# One-liner: source + model paths → Labels
labels = predict("video.mp4", model_paths=["/path/to/model"])

# Two-step: build once, predict many times with different settings
predictor = Predictor.from_model_paths(["/path/to/model"], device="cuda")
labels = predictor.predict("video.mp4", peak_threshold=0.3)

Modules:

Name Description
bottomup

Inference modules for BottomUp models.

centroid_convert

Conversion helpers for centroid-only output representation.

embedding

Inference for the embedding model type: crops -> appearance vectors.

filters

Post-inference filtering: FilterConfig + FilterPipeline.

identity

Backward-compatibility re-export shim for identity ops.

layers

Inference layers — model-type-aware wrappers around a runtime backend.

loaders

Standalone checkpoint loading for the inference pipeline.

ops

Pure-ops library for inference (PR 1 of #508).

outputs

Outputs — the structured container produced by every InferenceLayer.

paf_grouping

Backward-compatibility re-export shim for PAF grouping.

peak_finding

Backward-compatibility re-export shim for peak finding.

postprocessing

Backward-compatibility re-export shim for post-inference filters.

predictor

Predictor — high-level orchestrator for the inference stack.

predictors

Predictors for running inference.

preprocess_info

PreprocInfo — preprocessing metadata used to reverse coordinate transforms.

provenance

Provenance metadata utilities for inference outputs.

providers

Provider protocol + concrete data sources for Predictor.

run

Top-level predict — one-call inference from model paths to Labels.

sam

SAM-powered prompted instance segmentation for INFERENCE.

segmentation

Inference utilities for bottom-up instance segmentation.

segmentation_convert

sleap-nn <-> sleap-io conversion helpers for instance segmentation masks.

single_instance

Inference modules for SingleInstance models.

streaming

Streaming primitives for the new inference stack.

tile_merger

Torch-native tiled inference: importance windows + accumulate/normalize canvas.

topdown

Inference modules for TopDown centroid and centered-instance models.

tracking

Tracking integration for the new Predictor flow.

utils

Miscellaneous utility functions for Inference modules.

writer

IncrementalLabelsWriter — buffered write of a .slp.