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 (see below).
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.
Installation:
Simply do (it only depends on ndx-pose and deeplabcut):
pip install dlc2nwb
Example within DeepLabCut
DeepLabCut's h5 data files can be readily converted to NWB format either via the GUI from the Analyze Videos tab or programmatically, as follows:
import deeplabcut
deeplabcut.analyze_videos_converth5_to_nwb(config_path, video_folder)
Note that DLC does not strictly depend on dlc2nwb just yet; if attempting to convert to NWB, a user would be asked to run pip install dlc2nwb.
Example use case of this package (directly):
Here is an example for converting DLC data to NWB format (and back). Notice you can also export your data directly from DeepLabCut.
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. The 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 also acknowledge feedback, and our collaboration with Ben Dichter, Ryan Ly and Oliver Ruebel.
Metadata
Release files for dlc2nwb 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dlc2nwb-0.3.tar.gz | 8.1 kB | Without provenance | Details for dlc2nwb-0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dlc2nwb-0.3-py3-none-any.whl | Python 3 | none | any | Details for dlc2nwb-0.3-py3-none-any.whl |
Total release size: 16.4 kB
Release files / dlc2nwb-0.3.tar.gz
| Download URL | dlc2nwb-0.3.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
489e645a6f88aedcb1e76ff6ab9e9d61ddf198bbe541eb73c8e553970538c2a0
|
|
BLAKE2b-256 checksum How to use checksums |
6d77b60f46e574ee4576f86886415d0db9a6b3bae8373fa0ce0b17793c20c606
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / dlc2nwb-0.3-py3-none-any.whl
| Download URL | dlc2nwb-0.3-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9907f802b884bc86aa8642344c487796d4cc05790b0b7b14131fd77edf9155fd
|
|
BLAKE2b-256 checksum How to use checksums |
e8df45f1b1292d39d4402b8cbd592053e4c9057ee23b880815c179ecd586f2e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for dlc2nwb 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.