Skip to main content

Generic badge Code style: blackLicense: LGPL v3

DLClibrary

DLClibrary is a lightweight library supporting universal functions for the DeepLabCut ecosystem.

Supported functions (at this point):

Quick start

Install

The package can be installed using pip:

pip install dlclibrary

:warning: warning, the closely named package dlclib is not an official DeepLabCut product. :warning:

Example Usage

Downloading a pretrained model from the model zoo:

from pathlib import Path
from dlclibrary import download_huggingface_model

# Creates a folder and downloads the model to it
model_dir = Path("./superanimal_quadruped_model")
model_dir.mkdir()
download_huggingface_model("superanimal_quadruped", model_dir)

PyTorch models available for a given dataset (compatible with DeepLabCut>=3.0) can be listed using the dlclibrary.get_available_detectors and dlclibrary.get_available_models methods. The datasets for which models are available can be listed using dlclibrary.get_available_datasets. Example use:

>>> import dlclibrary
>>> dlclibrary.get_available_datasets()
['superanimal_bird', 'superanimal_topviewmouse', 'superanimal_quadruped']

>>> dlclibrary.get_available_detectors("superanimal_bird")
['fasterrcnn_mobilenet_v3_large_fpn', 'ssdlite']

>>> dlclibrary.get_available_models("superanimal_bird")
['resnet_50']

How to add a new model?

TensorFlow models

Pick a good model_name. Follow the (novel) naming convention (modeltype_species), e.g. superanimal_topviewmouse.

  1. Add the model_name with path and commit ID to: https://github.com/DeepLabCut/DLClibrary/blob/main/dlclibrary/dlcmodelzoo/modelzoo_urls.yaml

  2. Add the model name to the constant: MODELOPTIONS https://github.com/DeepLabCut/DLClibrary/blob/main/dlclibrary/dlcmodelzoo/modelzoo_download.py#L15

  3. For superanimal models also fill in the configs!

PyTorch models (for deeplabcut >= 3.0.0)

PyTorch models are listed in dlclibrary/dlcmodelzoo/modelzoo_urls_pytorch.yaml. The file is organized as:

my_cool_dataset:  # name of the dataset used to train the model
  detectors:
    detector_name: path/to/huggingface-detector.pt  # add detectors under `detector`
  pose_models:
    pose_model_name: path/to/huggingface-pose-model.pt  # add pose models under `pose_models`
    other_pose_model_name: path/to/huggingface-other-pose-model.pt

This will allow users to download the models using the format datatsetName_modelName, i.e. for this example 3 models would be available: my_cool_dataset_detector_name, my_cool_dataset_pose_model_name and my_cool_dataset_other_pose_model_name.

To add a new model for deeplabcut >= 3.0.0, simply:

  • add a new line under detectors or pose models if the dataset is already defined
  • add the structure if the model was trained on a new dataset

The models will then be listed when calling dlclibrary.get_available_detectors or dlclibrary.get_available_models! You can list the datasets for which models are available using dlclibrary.get_available_datasets.

Metadata

Release files for dlclibrary 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dlclibrary 0.0.7
File Size Uploaded
dlclibrary-0.0.7.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dlclibrary 0.0.7
File Interpreter ABI Platform
dlclibrary-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 28.8 kB

Release files / dlclibrary-0.0.7.tar.gz

Download URL dlclibrary-0.0.7.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3a5ccf039639e4ccc7b40e1af26c89d55464718a60f1b92ddeccc39fa386e7b8
BLAKE2b-256 checksum
How to use checksums
b5838230def638feb1c9482fa3ec0cf0269ee472b985b05061f5f7a12d7dc4d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release files / dlclibrary-0.0.7-py3-none-any.whl

Download URL dlclibrary-0.0.7-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dced5ccf237691175c3bdf52a7aa433457e96e1eb3f1b560237731da16c574e3
BLAKE2b-256 checksum
How to use checksums
f5bb185bc013828b46c6e1c9d1e31b4c5b24dc61204a058d69eb0f51e832bd9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release history Release notifications | RSS feed

0.0.12

2 release files

0.0.9

2 release files

0.0.8

2 release files

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page