napari + DeepLabCut annotation tool
Project description
napari-deeplabcut
A napari plugin for keypoint annotation with DeepLabCut
Installation
You can install napari-deeplabcut via pip:
pip install napari-deeplabcut
To install latest development version :
pip install git+https://github.com/DeepLabCut/napari-deeplabcut.git
Usage
To use the plugin, please run:
napari
Then, activate the plugin in Plugins > napari-deeplabcut: Keypoint controls.
All accepted files (config.yaml, images, h5 data files) can be loaded either by dropping them directly onto the canvas or via the File menu.
The easiest way to get started is to drop a folder (typically a folder from within a DeepLabCut's labeled-data directory), and, if labeling from scratch, drop the corresponding config.yaml to automatically add a Points layer and populate the dropdown menus.
Tools & shortcuts are:
2and3, to easily switch between labeling and selection mode4, to enable pan & zoom (which is achieved using the mouse wheel or finger scrolling on the Trackpad)M, to cycle through regular (sequential), quick, and cycle annotation mode (see the description here)E, to enable edge coloring (by default, if using this in refinement GUI mode, points with a confidence lower than 0.6 are marked in red)F, to toggle between animal and body part color scheme.backspaceto delete a point.- Check the box "display text" to show the label names on the canvas.
- To move to another folder, be sure to save (Ctrl+S), then delete the layers, and re-drag/drop the next folder.
Save Layers
Annotations and segmentations are saved with File > Save Selected Layer(s)... (or its shortcut Ctrl+S).
Only when saving segmentation masks does a save file dialog pop up to name the destination folder;
keypoint annotations are otherwise automatically saved in the corresponding folder as CollectedData_<ScorerName>.h5.
- As a reminder, DLC will only use the H5 file; so be sure if you open already labeled images you save/overwrite the H5.
- Note, before saving a layer, make sure the points layer is selected. If the user clicked on the image(s) layer first, does
Save As, then closes the window, any labeling work during that session will be lost!
Workflow
Suggested workflows, depending on the image folder contents:
-
Labeling from scratch – the image folder does not contain
CollectedData_<ScorerName>.h5file.Open napari as described in Usage and open an image folder together with the DeepLabCut project's
config.yaml. The image folder creates an image layer with the images to label. Supported image formats are:jpg,jpeg,png. Theconfig.yamlfile creates a Points layer, which holds metadata (such as keypoints read from the config file) necessary for labeling. Select the Points layer in the layer list (lower left pane on the GUI) and click on the +-symbol in the layer controls menu (upper left pane) to start labeling. The current keypoint can be viewed/selected in the keypoints dropdown menu (right pane). The slider below the displayed image (or the left/right arrow keys) allows selecting the image to label.To save the labeling progress refer to Save Layers.
Data successfully savedshould be shown in the status bar, and the image folder should now contain aCollectedData_<ScorerName>.h5file. (Note: For convenience, a CSV file with the same name is also saved.) -
Resuming labeling – the image folder contains a
CollectedData_<ScorerName>.h5file.Open napari and open an image folder (which needs to contain a
CollectedData_<ScorerName>.h5file). In this case, it is not necessary to open the DLC project'sconfig.yamlfile, as all necessary metadata is read from theh5data file.Saving works as described in 1.
-
Refining labels – the image folder contains a
machinelabels-iter<#>.h5file.The process is analog to 2.
-
Drawing segmentation masks
Drop an image folder as in 1, manually add a shapes layer. Then select the rectangle in the layer controls (top left pane), and start drawing rectangles over the images. Masks and rectangle vertices are saved as described in Save Layers. Note that masks can be reloaded and edited at a later stage by dropping the
vertices.csvfile onto the canvas.
Labeling multiple image folders
Labeling multiple image folders has to be done in sequence; i.e., only one image folder can be opened at a time. After labeling the images of a particular folder is done and the associated Points layer has been saved, all layers should be removed from the layers list (lower left pane on the GUI) by selecting them and clicking on the trashcan icon. Now, another image folder can be labeled, following the process described in 1, 2, or 3, depending on the particular image folder.
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
To locally install the code, please git clone the repo and then run pip install -e .
License
Distributed under the terms of the BSD-3 license, "napari-deeplabcut" is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Acknowledgements
This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template. We thank the Chan Zuckerberg Initiative (CZI) for funding this work!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file napari_deeplabcut-0.0.3.tar.gz.
File metadata
- Download URL: napari_deeplabcut-0.0.3.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
294e2c69bf8ef5d4567c414281c20c1a8d2c1f0473e7eb8f076448cedb51c0c4
|
|
| MD5 |
c7ec8c86716eaaf8d87d6dd1f37a9996
|
|
| BLAKE2b-256 |
c7c6df8473a7a61721abce854413719194cf7ed06d3b2a9ba834be9de86b0a29
|
File details
Details for the file napari_deeplabcut-0.0.3-py3-none-any.whl.
File metadata
- Download URL: napari_deeplabcut-0.0.3-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c0382bd72a08ec2bae0af782469d605173620461c0b08f5e87fd92333a5e0f3
|
|
| MD5 |
1069e60ff6d87c8e386a33eb2906fb00
|
|
| BLAKE2b-256 |
64fe7bfe1b1b3ede1209a33b6e87cc86a460263ac55b5a098eec3bbb9ef767ad
|