GithubHelp home page GithubHelp logo

cbroz1 / dlc2nwb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from deeplabcut/dlc2nwb

0.0 0.0 0.0 298 KB

Utilities to convert DeepLabCut (DLC), output to/from Neurodata Without Borders (NWB) format.

License: MIT License

Shell 0.78% Python 99.22%

dlc2nwb's Introduction

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. This will be further documented, and is currently in this branch!

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.

dlc2nwb's People

Contributors

alexemg avatar bendichter avatar cbroz1 avatar jeylau avatar mmathislab avatar saksham20 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.