python-dlclib
A wrapper of DeepLabCut for its ease of use.
dlclib is supposed to work with almost all single-camera setups of all DLC versions.
Installation
It is better building your DeepLabCut environment first, before running:
$ pip install dlclib
Classes
dlclib.estimate.TFSession
A thin wrapper over the DeepLabCut inference network based on TensorFlow.
session = TFSession.from_config(cfg)will return aTFSessionobject using the specifiedconfig.yamlfile of the DeepLabCut project.session.get_pose(image)will return anumpy.ndarraycorresponding to the estimation. for a batch-processing network, use a list of images, or a 4-D uint8 array whose axis 0 correspond to indexes of images.session.open_writer(path)opens a CSVWriter at the specified path (see below).
dlclib.posture.PostureMapper
A utility class that maps the output of TFSession to a dictionary.
Note that the current implementation:
-
does not care anything about conversion speed.
-
currently only supports non-batch models.
-
mapper = PostureMapper.from_config(cfg)will return aPostureMapperobject using the specifiedconfig.yamlfile of the DeepLabCut project. -
posedict = mapper.map(pose)receives the output ofTFSession.get_pose(), and returns a dictionary.posedict[part]is a named tuple that hasx,yandprobattributes.
dlclib.writer.CSVWriter
A simple class for writing the estimation into a CSV file. This class does support batch-processing networks.
writer = session.open_writer(path)from aTFSessionobject initializes the writer associated with the inference session.- For every video frame, you can call
writer.push(frame). It automatically callsTFSession.get_pose()internally, and writes its outputs into the file. - Calling
writer.flush()will flush the pended video frames (in case of batch modes; it does not wait for more frames and runsget_pose()to writes the estimation). - Calling
writer.close()will flush its internal buffer, close the file and invalidates itself. You can keep using the originatingTFSessionobject.
This class supports the context-manager model, so you can write:
with session.open_writer(path) as out:
for frame in video_frames:
out.push(frame)
License
2020-2021 Keisuke Sehara, the MIT License
Metadata
Release files for dlclib 1.1.0
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 |
|---|---|---|---|---|
| dlclib-1.1.0.tar.gz | 7.2 kB | Without provenance | Details for dlclib-1.1.0.tar.gz |
Release files / dlclib-1.1.0.tar.gz
| Download URL | dlclib-1.1.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
947e8ca9fe55124e3e75746a6db66d04480ccb9e3a676be617a8fac8f101aaee
|
|
BLAKE2b-256 checksum How to use checksums |
4fab8bf4a535b623e4220fe17a1db3cefd51c43a169c6ba7f2166e3d8609bb7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Security for dlclib 1.1.0
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.