Skip to main content

DeepLabCut <-> NWB conversion utilities

Project description

Welcome to the DeepLabCut 2 Neurodata Without Borders Repo

Here we provide utilities to convert DeepLabCut (DLC) output to/from Neurodata Without Borders (NWB) format. This repository also elaborates a way for how pose estimation data should be represented in NWB.

Specifically, this package allows you to convert DLC's predictions on videos (*.h5 files) into NWB format. This is best explained with an [example](# Example use:).

Installation:

Simply:

pip install dlc2nwb

NWB pose ontology

The standard is presented here. Our code is based on this NWB extension (PoseEstimationSeries, PoseEstimation) that was developed with Ben Dichter, Ryan Ly and Oliver Ruebel.

Example

see here.

from dlc2nwb.utils import convert_h5_to_nwb, convert_nwb_to_h5

# Convert DLC -> NWB:
nwbfile = convert_h5_to_nwb(
    'examples/config.yaml',
    'examples/m3v1mp4DLC_resnet50_openfieldAug20shuffle1_30000.h5',
)

# Convert NWB -> DLC
df = convert_nwb_to_h5(nwbfile[0])

Example data to run the code is provided in the folder examples. This data is based on a DLC project you can find on Zenodo and that was originally presented in Mathis et al., Nat. Neuro as well as Mathis et al., Neuron.

To limit space, the folder only contains the project file config.yaml and DLC predictions for an example video called m3v1mp4.mp4, which are stored in *.h5 format. The video is available, here.

Funding and contributions:

We gratefully acknowledge the generous support from the Kavli Foundation via a Kavli Neurodata Without Borders Seed Grants .

We furthermore acknowledge feedback and discussions with Ben Dichter, Ryan Ly and Oliver Ruebel.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dlc2nwb-0.0.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

dlc2nwb-0.0-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page