๐ API Reference๏
This section provides a categorized reference of SimBAโs modules and methods, grouped by their functionality such as feature extraction, plotting, transformation, and modeling.
๐ Find anything fast
Browse the Module Index โ an alphabetical list of every SimBA module, and the quickest way to find where a class or function lives.
Or jump to the General Index (every class, function and term, AโZ), or use full-text search.
๐ Blob tracking tools๏
Track animals in videos using background subtraction and blob detection โ an alternative to pose-estimation that needs no trained keypoint model. Detected blob contours are converted into geometric features such as the animalโs center, nose, tail, and left/right flank points, so downstream movement, ROI, and geometry analyses work from the silhouette alone. Well suited to single-animal, high-contrast recordings where a full pose model is unnecessary.
๐ฆ Bounding-box tools๏
Build bounding boxes and anchored polygons around animals from pose-estimation data, then quantify how they overlap through time. Useful for detecting proximity-based social interactions โ one animal entering anotherโs space, or body parts coming into contact โ without training a dedicated classifier. Overlap statistics can be aggregated per-animal and per-frame for downstream analysis.
See tutorial: Anchored ROI (bounding box) tutorial
- Bounding-box tools
- YOLO methods
- Utilities
- Bounding-box inference
- NVDEC GPU-accelerated YOLO inference
- Pose-estimation inference
- YOLO pose-estimation segmentation visualizer
- YOLO pose-estimation segmentation inference
- Pose-estimation track inference
- Pose-estimation track plotting
- Pose-estimation plotting
- Bounding box plotting
- YOLO annotation visualizer
- COCO key-points -> YOLO pose-estimation format conversion
- COCO key-points -> YOLO bounding box conversion
- COCO key-points -> YOLO segmentation conversion
- SAM3 -> YOLO segmentation project
- SAM3 -> YOLO bounding-box (detection) project
- Merge multiple YOLO projects
- Multi-animal DeepLabCut predictions -> YOLO pose-estimation annotations format conversion
- DeepLabCut predictions -> YOLO pose-estimation annotations
- Labelme annotations -> YOLO bounding box annotations
- Labelme points -> YOLO keypoints annotations
- Labelme points -> YOLO segmentation annotations
- SimBA ROIs -> YOLO bounding box annotations
- SimBA pose-estimation -> YOLO pose-estimation annotations
- SimBA pose-estimation -> YOLO segmentation annotations
- SLEAP CSV predictions -> YOLO pose-estimation annotations
- SLEAP H5 predictions -> YOLO pose-estimation annotations
- SLEAP annotations -> YOLO pose-estimation annotations
- LightningPose keypoints -> YOLO bounding box conversion
- LightningPose keypoints -> YOLO pose-estimation annotations
๐ Circular transformations๏
Statistical operations for circular data such as head direction and heading angle, where values wrap around 360ยฐ. Wraparound-aware and multi-animal capable, these methods derive base angles from body-part triplets and compute quantities like mean resultant vector length, angular difference, directional dispersion, and the Rayleigh test โ in both sliding-window and whole-session forms. GPU-accelerated variants are available for large datasets.
๐ง Config reader๏
Parse SimBA project configuration (project_config.ini) and expose project metadata โ file paths, animal and body-part definitions, video parameters, and classifier settings. Most SimBA classes inherit from this reader so they can locate data and resolve project-wide options consistently, rather than re-parsing the config themselves.
๐ก Cue-light tools๏
Link animal behavior to the on/off state of cue lights in the arena. Detect illumination changes from ROI pixel intensity, then summarize movement and classified behavior in the periods before, during, and after each light event โ for analyses of conditioned or stimulus-driven responses.
See tutorial: Cue-light tutorial
๐ง Data processing tools๏
Transform classification, tracking, and image data after feature extraction or model inference. Includes interpolation and smoothing of pose data, aggregation of classifier results, and specialized calculators such as Kleinberg burst detection, the forward spike-time tiling coefficient (FSTTC), and movement and severity scoring.
๐ Feature extraction mixins๏
Core low-level feature methods โ distances, angles, velocities, areas, and body-part relationships โ that the default extraction pipelines assemble into full feature sets. Use these directly to compose custom features from raw tracking coordinates when the out-of-the-box extractors donโt fit your schema.
๐ Feature extraction wrappers๏
Pre-configured โout-of-the-boxโ feature extraction modules for common pose-estimation schemas, spanning a range of single- and multi-animal body-part layouts. Each wrapper turns raw tracking coordinates into the tabular feature set that SimBA classifiers are trained and run on, so most users never have to write feature code by hand.
๐ Geometry transformations๏
Transform pose-estimated body-part coordinates into geometric shapes โ bounding boxes, polygons, circles, and lines โ and compute spatial relationships between them. Supports buffering, unions and intersections, point-in-shape tests, inter-shape distances, overlap, and directionality. Built on Shapely, with GPU-accelerated variants for many of the heavier operations.
โ๏ธ Global configuration๏
Global SimBA settings and environment variables โ GPU toggles, default paths, and feature flags โ that tune runtime behaviour across the package. Set these once to change how modules execute (for example, enabling numba eager compilation or GPU code paths) without editing individual scripts.
โก GPU acceleration๏
CUDA/CuPy-accelerated versions of SimBAโs compute-heavy routines โ geometry, image, background subtraction, statistics, circular statistics, time-series, and SHAP โ consolidated in one place. On a supported NVIDIA GPU they produce the same results as their CPU counterparts but run orders of magnitude faster on large datasets, with per-function expected-runtime tables to help you gauge the speed-up.
- GPU acceleration
- Geometry (GPU)
- Image (GPU)
- Background subtraction (GPU)
- Pose plotting (GPU)
- Greyscale conversion (GPU)
- CLAHE (GPU)
- Egocentric rotation (GPU)
- Geometry overlay (GPU)
- Statistics (GPU)
- Circular statistics (GPU)
- Time-series statistics (GPU)
- Feature extraction (GPU)
- Feature extraction supplement (GPU)
- SHAP explanations (GPU)
- Data transformations (GPU)
- GPU utilities
๐ผ๏ธ Image transformations๏
Manipulate video frames and extract visual information from tracking data โ crop, slice, rotate, and greyscale frames, isolate regions around body parts, and compute pixel-based features. Includes methods for comparing image features across time (e.g. frame-to-frame change), with both CPU and GPU implementations.
๐ท๏ธ Labeling tools๏
Interactive tools for annotating behavioral events frame by frame. Create and edit the ground-truth labels used to train classifiers, review and correct model predictions directly on the video, and manage annotations across a projectโs videos.
๐งฉ Mixins (overview)๏
Entry point to SimBAโs mixin classes โ the reusable method libraries (feature, geometry, statistics, plotting, image, network, timeseries, model) that the other topical sections draw on. Grouping shared functionality here keeps it consistent and testable across the package; most user-facing tools are thin wrappers that combine these mixins.
๐ค Model tools๏
Create, train, evaluate, and apply SimBAโs behavior classifiers (random-forest based). Configure hyperparameters, run cross-validation, generate evaluation metrics and plots such as feature importances and learning curves, and batch-apply trained models to new videos to produce per-frame behavior probabilities.
- Model tools
- Model mixin
- Batch random forest inference
- Batch multi-animal random forest inference
- Batch multi-class random forest inference
- Grid-search random forest classifiers
- Grid-search random forest multi-classifiers
- Random forest inference - validation
- Fit random forest classifier
- Fit random forest classifier - multi-class
- Ordinal classifier methods
- Regression - metrics
- Regression - fit and transform
- SAM2 segmentation inference
- Fit YOLO model
- YOLO bounding-box inference
๐ Network transformations๏
Build and analyze graphs derived from pose-estimation time-series โ for example, interaction networks between animals or connectivity between body parts. Compute node and edge metrics and visualize how the networkโs structure changes over time.
โ ๏ธ Outlier correction๏
Heuristic filtering of implausible body-part tracking. Location- and movement-based criteria โ scaled by a reference inter-body-part distance โ flag and correct jitter and sudden, physically impossible jumps before feature extraction, improving the quality of downstream features and classification.
๐จ Plotting and visualization tools๏
Visualize behavioral data and pose-tracking outputs โ Gantt plots, path, distance and velocity plots, heatmaps, classification-probability charts, and data overlays rendered onto the original video. Produces both static figures and frame-by-frame videos, with multiprocessing support for large batches.
- Plotting and visualization tools
- Direction between animals
- Direction between animals - multiprocess
- ROI feature visualization
- ROI feature visualization - multiprocess
- ROI directing visualization
- ROI visualizer
- ROI visualizer - multiprocess
- Circular base feature plotter
- Circular diffusion plotting
- Classifier validation
- Classifier validation - multiprocess
- Data plotter
- Distance plotter
- Distance plotter - multiprocess
- Quick path plot (Ez path plot)
- Merge videos
- Gantt plot
- Gantt plot - multiprocess
- Gantt plot - fancy
- Classifier heatmaps
- Classifier heatmaps - multiprocess
- Location heatmaps
- Location heatmaps - multiprocess
- Interactive classifier probability plotter
- Path plotter
- Path plotter - multiprocess
- Classification plotter
- Classification plotter - multiprocess
- Annotation bout plotter
- Pose-estimation plotter
- Pose-estimation plotter - GPU (NVDEC/NVENC)
- Skeleton video creator
- Classification probability plotter
- Classification probability plotter - multiprocess
- SHAP aggregation plotter
- Single video validation plotter
- Single video validation plotter - multiprocess
- Geometry plotter (generic)
- Geometry plotter - GPU (NVDEC/NVENC)
- Spontaneous alternation plotter
- โBlobโ plotter
- โBlobโ plotter
- YOLO bounding-box plotter
- YOLO model comparator
- Plotting methods
- Light-/Dark-box plotting
๐ฆ Pose-estimation import tools๏
Parse, load, and standardize pose-estimation output from common trackers (e.g. DeepLabCut, SLEAP, DeepPoseKit, MARS) across H5, CSV, and JSON formats. Handles single- and multi-animal data and can interpolate and smooth tracking on import, producing the consistent internal format the rest of SimBA expects.
- Pose-estimation import tools
- Import single DLC CSV file
- Import MARS pose-estimation data
- Import DANNCE pose-estimation data
- Import SLEAP CSV pose-estimation data
- Import SLEAP H5 pose-estimation data
- Import SLEAP SLP pose-estimation data
- Import APT TRK pose-estimation data
- Import DLC H5 files
- Reset pose
- Remove key-points
- Re-organize key-points
- Reverse pose
- Pose import mixins
- Import SimBA blob tracking as pose
- Import FaceMap body-part tracking
- Import SuperAnimal-TopView Mouse body-part tracking
- Import YOLO pose-estimation tracking (unique individuals, non-track based, only)
๐บ๏ธ ROI tools๏
Define regions-of-interest โ rectangles, circles, and polygons โ and analyze tracking in relation to them. Compute zone entries and exits, time and distance spent in each region, distance to ROI boundaries, and whether animals are oriented toward a region, with visualization tools for the results.
๐ Statistics transformations๏
Compute statistical features from tracking and classification data โ descriptive statistics, distribution comparisons, distance metrics, and drift/change detection โ over sliding or static time windows. Underpins much of SimBAโs feature extraction, and many methods have GPU-accelerated counterparts for large datasets.
๐ฅ Third-party label appenders๏
Import behavioral annotations produced by external tools (e.g. BORIS, Ethovision, Observer, DeepEthogram, SOLOMON) and align them, frame by frame, to SimBAโs pose-estimation and feature data. Lets you reuse existing human or third-party labels as classifier training targets without re-annotating.
- Third-party label appenders
- BENTO
- BORIS
- BORIS source cleaner
- Deepethogram
- Ethovison
- Noldus Observer
- Solomon coder
- Shah appender
- Generic third-party appender tool
- Third-party annotation tools
- Annotation format converters
- COCO key-points -> YOLO pose-estimation format conversion
- COCO key-points -> YOLO bounding box conversion
- COCO key-points -> YOLO segmentation conversion
- SAM3 -> YOLO segmentation project
- SAM3 -> YOLO bounding-box (detection) project
- Merge multiple YOLO projects
- Multi-animal DeepLabCut predictions -> YOLO pose-estimation annotations format conversion
- DeepLabCut predictions -> YOLO pose-estimation annotations
- Lightning Pose annotations -> YOLO pose-estimation annotations
- Lightning Pose annotations -> YOLO bounding box annotations
- Merge Lightning Pose projects
- Crop Lightning Pose annotations
- Crop Lightning Pose annotations (bounding box square)
- Create Lightning Pose bounding box files
- Multi-animal DeepLabCut -> YOLO pose-estimation annotations
- DeepLabCut single-to-multi-animal format converter
- DeepLabCut annotations -> Labelme annotations
- Labelme annotations -> DeepLabCut annotations
- Labelme annotations -> DataFrame
- Labelme annotations -> YOLO bounding box annotations
- Labelme points -> YOLO keypoints annotations
- Labelme points -> YOLO segmentation annotations
- SimBA ROIs -> YOLO bounding box annotations
- SimBA pose-estimation -> YOLO pose-estimation annotations
- SimBA pose-estimation -> YOLO segmentation annotations
- SLEAP CSV predictions -> YOLO pose-estimation annotations
- SLEAP H5 predictions -> YOLO pose-estimation annotations
- SLEAP annotations -> YOLO pose-estimation annotations
- Annotation conversion utilities
- YOLO labels -> YOLO detection project
- Visualize YOLO annotations on images
๐ Time-series transformations๏
Analyze the temporal structure of tracking and feature signals using sliding-window methods โ complexity and entropy measures, autocorrelation, and windowed descriptive statistics โ to capture how behavior evolves over time. GPU-accelerated variants are available for the heavier computations.
๐ฎ Unsupervised learning๏
Discover behavioral structure without labels. Combines dimensionality reduction (e.g. UMAP, PCA) with clustering (e.g. HDBSCAN, K-means), plus tools to embed, visualize, and quantify the resulting clusters โ a workflow for surfacing candidate behavioral motifs from feature data.
๐ฅ๏ธ User Interface (UI) tools๏
SimBAโs graphical interface components โ the Tkinter windows, pop-ups, and menus that drive project creation, configuration, and each step of the analysis workflow. The entry point for users who prefer clicking through SimBA rather than scripting it.
โ๏ธ Utilities๏
Helper methods used throughout the package โ logging, CLI execution, input and argument validation, warnings, timing, and reading/writing project files. The shared plumbing that keeps SimBAโs error messages, checks, and file handling consistent across every module.
See also
Further utility modules are documented alongside the features they support: YOLO utilities (dataset conversion and training/inference helpers), CUDA / GPU utilities (low-level device primitives and the NVDEC video-decoder factory), and the custom feature extractor.
๐น Video processing tools๏
Video processing tools built on OpenCV and FFmpeg โ clip, crop, concatenate, downsample, re-encode, rotate, and greyscale videos, and compute average/background frames. Covers the common pre-processing steps needed to get raw recordings ready for tracking and analysis, with multiprocessing support for batch jobs.
๐๏ธ YOLO Methods๏
Methods for training YOLO models, creating training and validation datasets, and converting behavioral neuroscience-specific datasets to YOLO datasets.
Uses the Ultralytics package.
- YOLO methods
- Utilities
- Bounding-box inference
- NVDEC GPU-accelerated YOLO inference
- Pose-estimation inference
- YOLO pose-estimation segmentation visualizer
- YOLO pose-estimation segmentation inference
- Pose-estimation track inference
- Pose-estimation track plotting
- Pose-estimation plotting
- Bounding box plotting
- YOLO annotation visualizer
- COCO key-points -> YOLO pose-estimation format conversion
- COCO key-points -> YOLO bounding box conversion
- COCO key-points -> YOLO segmentation conversion
- SAM3 -> YOLO segmentation project
- SAM3 -> YOLO bounding-box (detection) project
- Merge multiple YOLO projects
- Multi-animal DeepLabCut predictions -> YOLO pose-estimation annotations format conversion
- DeepLabCut predictions -> YOLO pose-estimation annotations
- Labelme annotations -> YOLO bounding box annotations
- Labelme points -> YOLO keypoints annotations
- Labelme points -> YOLO segmentation annotations
- SimBA ROIs -> YOLO bounding box annotations
- SimBA pose-estimation -> YOLO pose-estimation annotations
- SimBA pose-estimation -> YOLO segmentation annotations
- SLEAP CSV predictions -> YOLO pose-estimation annotations
- SLEAP H5 predictions -> YOLO pose-estimation annotations
- SLEAP annotations -> YOLO pose-estimation annotations
- LightningPose keypoints -> YOLO bounding box conversion
- LightningPose keypoints -> YOLO pose-estimation annotations