sleap.io.format.deeplabcut

Adaptor for reading DeepLabCut datasets.

This can either read a CSV file with labeled frames for a single video, or a YAML file which potentially contains multiple videos.

The adaptor was created by manually inspecting DeepLabCut files and there’s no guarantee that it will perfectly import all data (especially metadata).

If the adaptor can find full video files for the annotated frames, then the full videos will be used in the resulting SLEAP dataset. Otherwise, we’ll create a video object which wraps the individual frame images.

class sleap.io.format.deeplabcut.LabelsDeepLabCutCsvAdaptor[source]

Reads DeepLabCut csv file with labeled frames for single video.

property all_exts

List of all file extensions supported by adaptor.

can_read_file(file: sleap.io.format.filehandle.FileHandle)[source]

Returns whether this adaptor can read this file.

can_write_filename(filename: str)[source]

Returns whether this adaptor can write format of this filename.

property default_ext

The default file extension, e.g., ‘json’ (without ‘.’).

does_read() bool[source]

Returns whether this adaptor supports reading.

does_write() bool[source]

Returns whether this adaptor supports writing.

property handles

Returns the type of object that can be read/written.

The Dispatch class calls this method on all registered adaptors to determine which to use for reading/writing.

classmethod make_video_for_image_list(image_dir, filenames) sleap.io.video.Video[source]

Creates a Video object from frame images.

property name

Human-reading name of the file format

classmethod read(file: sleap.io.format.filehandle.FileHandle, full_video: Optional[sleap.io.video.Video] = None, *args, **kwargs) sleap.io.dataset.Labels[source]

Reads the file and returns the appropriate deserialized object.

class sleap.io.format.deeplabcut.LabelsDeepLabCutYamlAdaptor[source]
property all_exts

List of all file extensions supported by adaptor.

can_read_file(file: sleap.io.format.filehandle.FileHandle)[source]

Returns whether this adaptor can read this file.

can_write_filename(filename: str)[source]

Returns whether this adaptor can write format of this filename.

property default_ext

The default file extension, e.g., ‘json’ (without ‘.’).

does_read() bool[source]

Returns whether this adaptor supports reading.

does_write() bool[source]

Returns whether this adaptor supports writing.

property handles

Returns the type of object that can be read/written.

The Dispatch class calls this method on all registered adaptors to determine which to use for reading/writing.

property name

Human-reading name of the file format

classmethod read(file: sleap.io.format.filehandle.FileHandle, *args, **kwargs) sleap.io.dataset.Labels[source]

Reads the file and returns the appropriate deserialized object.