Skip to content

Edit DeepLabCut labels from HDF files. Save edited files in both HDF and MATLAB file formats.

License

Notifications You must be signed in to change notification settings

jonperdomo/dlc-label-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Label editor

Edit labels from DeepLabCut analysis outputs and save as a separate file in both HDF and MATLAB file formats.

Installation

Install Anaconda Python 3.7

Install dependencies by using the provided file to create the labeleditor conda environment:

conda env create -f environment.yaml

Running

Open Anaconda Prompt and activate the conda environment:

activate labeleditor

In Anaconda Prompt, change the directory to dlc-label-editor/ and add the label and video filepaths as the first and second arguments:

python editor.py labelfile videofile

Example:

python editor.py SampleData\reachingvideo1DLC_resnet50_ReachingAug30shuffle1_200000.h5 SampleData/reachingvideo1.avi

(Note: After you have edited once, you can use the generated file *_Fixed.h5 as the first argument to work on a previously edited file)

alt text

Editing labels

Change the active label and scroll through frames by using the sliders or the <> keys (not the arrow pad).

Left-click the corrected position and the HDF file will be automatically saved with extension *_Fixed.h5

Place points faster by holding the left mouse button while scrolling with <>

Press the ESC key to exit.

Changing the marker appearance

The three parameters after the filepaths are for marker appearance:

  • color (red, green, or blue; default=blue)
  • size (default=40)
  • thickness (default=2)

Example:

python editor.py SampleData\reachingvideo1DLC_resnet50_ReachingAug30shuffle1_200000.h5 SampleData/reachingvideo1.avi red 100 3

alt text

MATLAB file format

The file will be saved in MATLAB (.MAT) format after you exit the editor as a structure with X, Y, and likelihood data.

Known issues

Pressing the window close button closes the UI but the video stays open. This is due to the limited functionality of OpenCV HighGUI. If this occurs just press ESC to exit.

Running the .H5 to .MAT file converter

Convert an individual .H5 label file to .MAT using the following command:

python matconverter.py labelfile

About

Edit DeepLabCut labels from HDF files. Save edited files in both HDF and MATLAB file formats.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages