DeepLabCut#

Helper functions for training embeddings on DeepLabCut outputs.

cebra.integrations.deeplabcut.load_deeplabcut(filepath, keypoints=None, pcutoff=0.6)#

Load DLC data from h5 files.

Parameters:
  • filepath (Union[Path, str]) – Path to the .h5 file containing DLC output data.

  • keypoints (Optional[list]) – List of keypoints to keep in the output numpy.array.

  • pcutoff (float) – Drop-out threshold. If the likelihood value on the estimated positions a sample is smaller than that threshold, then the sample is set to nan. Then, the nan values are interpolated.

Return type:

ndarray[tuple[int, ...], dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns:

A 2D array (n_samples x n_features) containing the data (x and y) generated by DLC for each keypoint of interest. Note that the likelihood is dropped.

Example

>>> import cebra
>>> url = ANNOTATED_DLC_URL = "https://github.com/DeepLabCut/DeepLabCut/blob/main/examples/Reaching-Mackenzie-2018-08-30/labeled-data/reachingvideo1/CollectedData_Mackenzie.h5?raw=true"
>>> file = cebra.helper.download_file_from_url(url) # an .h5 example file
>>> dlc_data = cebra.load_deeplabcut(file, keypoints=["Hand", "Joystick1"], pcutoff=0.6)