DIPLOMAT API

DIPLOMAT includes the following python interfaces and plugins below.

Core Functions

Python functions that are equivalents for DIPLOMAT’s command line interface.

list_predictor_plugins()

Retrieve and print all currently installed and available predictor plugins that can be used with deeplabcut to the console...

get_predictor_settings([predictor])

Prints the available/modifiable settings for a specified predictor plugin.

test_predictor_plugin([predictor, interactive])

Run the tests for a predictor plugin.

list_all_frontends()

List all frontends currently included with this version of DIPLOMAT.

list_loaded_frontends()

List frontends that have successfully loaded, and list their supported functions.

split_videos(videos[, seconds_per_segment, ...])

Split a video into even length segments.

track_with(config[, videos, frame_stores, ...])

Run DIPLOMAT tracking on videos and/or frame stores.

track_and_interact(config[, videos, ...])

Run diplomat in interactive tracking mode on the specified config and videos or frame stores.

track(config[, videos, frame_stores, ...])

Run diplomat in a non-interactive tracking mode on the specified config and videos or frame stores.

annotate(config[, videos, help_extra])

Have diplomat annotate, or label a video given it has already been tracked.

tweak(config[, videos, help_extra])

Make modifications to DIPLOMAT produced tracking results created for a video using a limited version of the interactive labeling UI.

yaml([run_config])

Run DIPLOMAT based on a passed yaml run script.

convert(config[, videos, help_extra])

Convert DIPLOMAT produced tracking results created for a video from the software specific format to a CSV file for inspection and analysis.

interact(state)

Open diplomat's interactive UI from a .dipui file.

Predictors

A list of the Predictor plugins included with DIPLOMAT by default. Predictors predict the exact locations of objects given probabilistic model outputs.

FastPlotterArgMax

Identical to PlotterArgMax, but avoids using matplotlib to generate probability maps, and instead directly uses cv2 to generate the plots. This means it runs much faster, but doesn’t offer as much customization nor a 3D mode…

SupervisedSegmentedFramePassEngine

The supervised (aka interactive) version of the SegmentedFramePassEngine predictor. Provides a GUI for modifying results at the end of the tracking process.

PlotterArgMax

Identical to ArgMax, but plots probability frames in form of video to the user using matplotlib…

SegmentedFramePassEngine

A predictor that applies a collection of frame passes to the frames dumped by deeplabcut, and then predicts poses by selecting maximums. Contains a collection of useful prediction algorithms which can be listed by calling “get_predictor_settings” on this Predictor. This version applies passes in segments, and then stitches those segments together.

FrameExporter

Exports probability maps to a binary format that can be passed back into DeepLabCut again to perform frame predictions later. This allows for a video to be run through the neural network (expensive) on a headless server or supercomputer, and then run through a predictor with gui feedback on a laptop or somewhere else.

ArgMax

Dummy predictor for DIPLOMAT. Predicts the point from the probability frames simply by selecting the max probability in each frame.

Frame Passes

A list of the FramePass plugins included by default with DIPLOMAT. Some Predictor plugins use frame passes to perform pose prediction, including the FramePassEngine and SegmentedFramePassEngine based predictors.

ClusterFrames

Breaks up each frame and separates it into a fixed number of frames, where each frame contains typically a single peak.

OptimizeStandardDeviation

Runs across the video and determines the optimal value for the standard deviation for the 2D gaussian transition function used in MITViterbi.

CreateSkeleton

Computes optimal skeletal link distances and then constructs a skeleton to be used by MITViterbi. The links can be passed directly to this frame pass or are otherwise inferred from the config file.

FixFrame

Scores frames by peak separation, and then selects a single frame to remain clustered (with peaks separated). The rest of the frames are restored, and MITViterbi uses the fixed frame as it’s ground truth frame.

MITViterbi

An implementation of the Multi-Individual Tracking Viterbi algorithm. Runs a viterbi-like algorithm across the frames to determine the maximum scoring paths per individual, assuming an individuals can’t take a paths that would have been more likely for other individuals to have taken.

Processing Module

diplomat.processing

This module defines the abstract base class for predictor plugins, and additional data structures, classes, and functions used for processing network outputs into body part pose predictions.

Utilities

diplomat.utils

This module includes general utility classes and functions used extensively in diplomat.

Frontends

A list of frontends that come included with DIPLOMAT. Frontends enable DIPLOMAT to run off of model results produced by a specific tracking software package and project.

sleap

The SLEAP frontend for DIPLOMAT. Contains functions for running DIPLOMAT on SLEAP projects.

csv

The CSV frontend for DIPLOMAT. Contains functions for running some DIPLOMAT operations on csv trajectory files. Supports video creation, and tweak UI commands.

deeplabcut

The DEEPLABCUT frontend for DIPLOMAT. Contains functions for running DIPLOMAT on DEEPLABCUT projects.

WX GUI Components

diplomat.wx_gui

A set of GUI controls and dialogs that come with DIPLOMAT.