API Docs

High Level API

When implementing your own benchmarks, the most important functions are directly accessible under the benchmark package.

benchmark.evaluate(include_benchmarks=None, results=None, on_error='return')

Run evaluation for all benchmarks and methods.

Note that in order for your custom benchmark to be included during evaluation, the following conditions need to be met:

  • The benchmark subclassed one of the benchmark definitions in in benchmark.benchmarks

  • The benchmark is registered by applying the @benchmark.register decorator to the class

  • The benchmark was imported. This is done automatically for all benchmarks that are defined in submodules or subpackages of the benchmark.submissions module. For all other locations, make sure to manually import the packages before calling the evaluate() function.

Parameters
  • include_benchmarks (Optional[Container[str]]) – If None, run all benchmarks that were discovered. If a container is passed, only include methods that were defined on benchmarks with the specified names. E.g., include_benchmarks = ["trimouse"] would only evaluate methods of the trimouse benchmark dataset.

  • on_error – see documentation in benchmark.base.Benchmark.evaluate()

Return type

ResultCollection

Returns

A collection of all results, which can be printed or exported to pd.DataFrame or json file formats.

benchmark.register(cls)

Add a benchmark to the list of evaluations to run.

Apply this function as a decorator to a class. Note that the class needs to be a subclass of the benchmark.base.Benchmark base class.

In most situations, it will be a subclass of one of the pre-defined benchmarks in benchmark.benchmarks.

Throws:

ValueError if the decorator is applied to a class that is not a subclass of benchmark.base.Benchmark.

Available benchmark definitions

The actual benchmark definitions.

class benchmark.benchmarks.FishBenchmark

Bases: benchmark.base.Benchmark

Dataset with multiple fish, filmed from top-view

Schools of inland silversides (Menidia beryllina, n=14 individuals per school) were recorded in the Lauder Lab at Harvard University while swimming at 15 speeds (0.5 to 8 BL/s, body length, at 0.5 BL/s intervals) in a flow tank with a total working section of 28 x 28 x 40 cm as described in previous work, at a constant temperature (18±1°C) and salinity (33 ppt), at a Reynolds number of approximately 10,000 (based on BL). Dorsal views of steady swimming across these speeds were recorded by high-speed video cameras (FASTCAM Mini AX50, Photron USA, San Diego, CA, USA) at 60-125 frames per second (feeding videos at 60 fps, swimming alone 125 fps). The dorsal view was recorded above the swim tunnel and a floating Plexiglas panel at the water surface prevented surface ripples from interfering with dorsal view videos. Five keypoints were labeled (tip, gill, peduncle, dorsal fin tip, caudal tip). 100 frames were labeled, making this a real-world sized laboratory dataset.

class benchmark.benchmarks.MarmosetBenchmark

Bases: benchmark.base.Benchmark

Dataset with two marmosets.

All animal procedures are overseen by veterinary staff of the MIT and Broad Institute Department of Comparative Medicine, in compliance with the NIH guide for the care and use of laboratory animals and approved by the MIT and Broad Institute animal care and use committees. Video of common marmosets (Callithrix jacchus) was collected in the laboratory of Guoping Feng at MIT. Marmosets were recorded using Kinect V2 cameras (Microsoft) with a resolution of 1080p and frame rate of 30 Hz. After acquisition, images to be used for training the network were manually cropped to 1000 x 1000 pixels or smaller. The dataset is 7,600 labeled frames from 40 different marmosets collected from 3 different colonies (in different facilities). Each cage contains a pair of marmosets, where one marmoset had light blue dye applied to its tufts. One human annotator labeled the 15 marker points on each animal present in the frame (frames contained either 1 or 2 animals).

class benchmark.benchmarks.ParentingMouseBenchmark

Bases: benchmark.base.Benchmark

Datasets with three mice, one parenting, two pups.

Parenting behavior is a pup directed behavior observed in adult mice involving complex motor actions directed towards the benefit of the offspring. These experiments were carried out in the laboratory of Catherine Dulac at Harvard University. The behavioral assay was performed in the homecage of singly housed adult female mice in dark/red light conditions. For these videos, the adult mice was monitored for several minutes in the cage followed by the introduction of pup (4 days old) in one corner of the cage. The behavior of the adult and pup was monitored for a duration of 15 minutes. Video was recorded at 30Hz using a Microsoft LifeCam camera (Part#: 6CH-00001) with a resolution of 1280 x 720 pixels or a Geovision camera (model no.: GV-BX4700-3V) also acquired at 30 frames per second at a resolution of 704 x 480 pixels. A human annotator labeled on the adult animal the same 12 body points as in the tri-mouse dataset, and five body points on the pup along its spine. Initially only the two ends were labeled, and intermediate points were added by interpolation and their positions was manually adjusted if necessary. All surgical and experimental procedures for mice were in accordance with the National Institutes of Health Guide for the Care and Use of Laboratory Animals and approved by the Harvard Institutional Animal Care and Use Committee. 542 frames were labeled, making this a real-world sized laboratory dataset.

class benchmark.benchmarks.TriMouseBenchmark

Bases: benchmark.base.Benchmark

Datasets with three mice with a top-view camera.

Three wild-type (C57BL/6J) male mice ran on a paper spool following odor trails (Mathis et al 2018). These experiments were carried out in the laboratory of Venkatesh N. Murthy at Harvard University. Data were recorded at 30 Hz with 640 x 480 pixels resolution acquired with a Point Grey Firefly FMVU-03MTM-CS. One human annotator was instructed to localize the 12 keypoints (snout, left ear, right ear, shoulder, four spine points, tail base and three tail points). All surgical and experimental procedures for mice were in accordance with the National Institutes of Health Guide for the Care and Use of Laboratory Animals and approved by the Harvard Institutional Animal Care and Use Committee. 161 frames were labeled, making this a real-world sized laboratory dataset.

Metric calculation

The interface to DeepLabCut is implemented in the benchmark.metrics package. For displaying results and testing your submission, it is not required to have DeepLabCut installed. However, once you intend to (re-) evaluate, make sure to have a working DeepLabCut installation.

benchmark.metrics.calc_map_from_obj(eval_results_obj, h5_file, metadata_file, oks_sigma=0.1, margin=0, symmetric_kpts=None, drop_kpts=None)

Calculate mean average precision (mAP) based on predictions.

benchmark.metrics.calc_rmse_from_obj(eval_results_obj, h5_file, metadata_file, drop_kpts=None)

Calc prediction errors for submissions.

benchmark.metrics.conv_obj_to_assemblies(eval_results_obj, keypoint_names)

Convert predictions to deeplabcut assemblies.