Developer API#

Hint

Head to our discussions page to get help from the SLEAP community.

sleap.instance

Data structures for all labeled data contained with a SLEAP project.

sleap.message

Module with classes for sending and receiving messages between processes.

sleap.skeleton

Implementation of skeleton data structure and API.

sleap.util

A miscellaneous set of utility functions.

sleap.info.align

Functions to align instances.

sleap.info.feature_suggestions

Module for generating lists of frames using frame features, pca, kmeans, etc.

sleap.info.labels

Command line utility which prints data about labels file.

sleap.info.metrics

Module for producing prediction metrics for SLEAP datasets.

sleap.info.summary

Module for getting a series which gives some statistic based on labeling data for each frame of some labeled video.

sleap.info.trackcleaner

CLI for TrackCleaner (mostly deprecated).

sleap.info.write_tracking_h5

Generate an HDF5 or CSV file with track occupancy and point location data.

sleap.nn.callbacks

Training-related tf.keras callbacks.

sleap.nn.evals

Evaluation utilities for measuring pose estimation accuracy.

sleap.nn.heads

Model head definitions for defining model output types.

sleap.nn.identity

Utilities for models that learn identity.

sleap.nn.inference

Inference pipelines and utilities.

sleap.nn.losses

Custom loss functions and metrics.

sleap.nn.model

This module defines the main SLEAP model class for defining a trainable model.

sleap.nn.paf_grouping

This module provides a set of utilities for grouping peaks based on PAFs.

sleap.nn.peak_finding

This module contains TensorFlow-based peak finding methods.

sleap.nn.system

Utilities for working with the physical system (e.g., GPUs).

sleap.nn.tracking

Tracking tools for linking grouped instances over time.

sleap.nn.training

Training functionality and high level APIs.

sleap.nn.utils

This module contains generic utilities used for training and inference.

sleap.nn.viz

Visualization and plotting utilities.

sleap.nn.data.augmentation

Transformers for applying data augmentation.

sleap.nn.data.confidence_maps

Transformers for confidence map generation.

sleap.nn.data.dataset_ops

Transformers for dataset (multi-example) operations, e.g., shuffling and batching.

sleap.nn.data.edge_maps

Transformers for generating edge confidence maps and part affinity fields.

sleap.nn.data.general

General purpose transformers for common pipeline processing tasks.

sleap.nn.data.grouping

Group inference results ("examples") by frame.

sleap.nn.data.identity

Utilities for generating data for track identity models.

sleap.nn.data.inference

Transformers for performing inference.

sleap.nn.data.instance_centroids

Transformers for finding instance centroids.

sleap.nn.data.instance_cropping

Transformers for cropping instances for topdown processing.

sleap.nn.data.normalization

Transformers for normalizing data formats.

sleap.nn.data.offset_regression

Utilities for creating offset regression maps.

sleap.nn.data.pipelines

This module defines high level pipeline configurations from providers/transformers.

sleap.nn.data.providers

Data providers for pipeline I/O.

sleap.nn.data.resizing

Transformers for image resizing and padding.

sleap.nn.data.training

Transformers and utilities for training-related operations.

sleap.nn.data.utils

Miscellaneous utility functions for data processing.

sleap.nn.config.data

sleap.nn.config.model

sleap.nn.config.optimization

sleap.nn.config.outputs

sleap.nn.config.training_job

Serializable configuration classes for specifying all training job parameters.

sleap.nn.config.utils

Utilities for config building and validation.

sleap.nn.architectures.common

Common utilities for architecture and model building.

sleap.nn.architectures.encoder_decoder

Generic encoder-decoder fully convolutional backbones.

sleap.nn.architectures.hourglass

This module provides a generalized implementation of (stacked) hourglass.

sleap.nn.architectures.hrnet

(Higher)HRNet backbone.

sleap.nn.architectures.leap

This module provides a generalized implementation of the LEAP CNN.

sleap.nn.architectures.pretrained_encoders

Encoder-decoder backbones with pretrained encoder models.

sleap.nn.architectures.resnet

ResNet-based backbones.

sleap.nn.architectures.unet

This module provides a generalized implementation of UNet.

sleap.nn.architectures.upsampling

This module defines common upsampling layer stack configurations.

sleap.nn.tracker.components

Functions/classes used by multiple trackers.

sleap.nn.tracker.kalman

Module to use Kalman filters for tracking instance identities.

sleap.io.convert

Command line utility for converting between various dataset formats.

sleap.io.dataset

A SLEAP dataset collects labeled video frames, together with required metadata.

sleap.io.legacy

Module for legacy LEAP dataset.

sleap.io.pathutils

Utilities for working with file paths.

sleap.io.video

Video reading and writing interfaces for different formats.

sleap.io.videowriter

Module for writing avi/mp4 videos.

sleap.io.visuals

Module for generating videos with visual annotation overlays.

sleap.io.format.adaptor

File format adaptor base class.

sleap.io.format.alphatracker

Adaptor for reading AlphaTracker datasets.

sleap.io.format.coco

Adaptor for reading COCO keypoint detection datasets.

sleap.io.format.csv

Adaptor for writing SLEAP analysis as csv.

sleap.io.format.deeplabcut

Adaptor for reading DeepLabCut datasets.

sleap.io.format.deepposekit

Adaptor for reading DeepPoseKit datasets (HDF5).

sleap.io.format.dispatch

Dispatcher for dynamically supporting multiple dataset file formats.

sleap.io.format.filehandle

File object which can be passed to adaptors.

sleap.io.format.genericjson

Adaptor for reading and writing any generic JSON file.

sleap.io.format.hdf5

Adaptor for reading/writing SLEAP datasets as HDF5 (including slp).

sleap.io.format.labels_json

Adaptor for reading/writing old, JSON dataset format (kind of deprecated).

sleap.io.format.leap_matlab

Adaptor to read (not write) LEAP MATLAB data files.

sleap.io.format.main

Read/write for multiple dataset formats.

sleap.io.format.ndx_pose

Adaptor to read and write ndx-pose files.

sleap.io.format.nix

sleap.io.format.sleap_analysis

Adaptor to read and write analysis HDF5 files.

sleap.io.format.text

Adaptor for reading and writing any generic text file.