pybvh-ml
ML bridge layer for pybvh — turn motion capture data into training-ready inputs for skeleton-based ML models.
Status: pre-1.0. Minor versions can include breaking API changes; see CHANGELOG.md for migration notes.
Documentation · Quick Start · Gallery — every concept, one picture each · Find a function · User Guide · Tutorials
Features
- Tensor packing to
(C, T, V),(T, V, C), and flat(T, D)layouts with round-trip unpacking. - Array-level augmentation in quaternion, 6D, axis-angle, rotmat, and Euler — keyword-only, no
Bvhround-trip, with composable pipelines and reproducible per-epoch seeding. - Preprocessing pipelines — BVH directory → on-disk dataset (
.npz/.hdf5) with skeleton-aware harmonization for heterogeneous corpora and dataset-wide z-score normalization. - Skeleton-graph metadata — edge lists, body-part partitions, L/R joint pairs for GCN and Transformer models.
- Optional PyTorch integration —
MotionDataset/OnTheFlyDataset/collate_motion_batchwith variable-length padding.
Philosophy
pybvh-ml is the layer between pybvh (which parses BVH files and does rotation math) and your model (which consumes tensors). It handles the data plumbing — tensor layout, augmentation, preprocessing, dataset construction — without making assumptions about your model or task. All core functions use NumPy; PyTorch is optional.
It replaces the ~150 lines of preprocessing, augmentation, and dataset-class boilerplate that most BVH-based ML pipelines reinvent. Composable enough to use one piece at a time (just the packer, just the augmentor); opinionated enough to give you a working data loader in a dozen lines.
Installation
pip install pybvh-ml
This pulls in pybvh >= 0.8.1, < 0.9 automatically — pybvh-ml 0.5 tracks pybvh 0.8's API (short representation tokens, radians-first parameters).
With optional dependencies:
pip install "pybvh-ml[torch]" # PyTorch Dataset classes
pip install "pybvh-ml[hdf5]" # HDF5 output support
Quick Start
import pybvh_ml
# Preprocess a directory of BVH files into a training-ready .npz.
summary = pybvh_ml.preprocess_directory(
"walks/", "train.npz", representation="6d",
)
print(f"{summary['num_clips']} clips, "
f"{summary['skeleton_info']['num_joints']} joints")
# Load back: per-clip arrays, normalization stats, skeleton metadata.
data = pybvh_ml.load_preprocessed("train.npz")
root_pos = data["clips"][0]["root_pos"] # (F, 3)
joint_rot = data["clips"][0]["joint_rot"] # (F, J, 6) for 6D
mean, std = data["mean"], data["std"] # for input normalization
# One clip travels as a MotionArrays — what every augmentation and packer takes.
arrays = pybvh_ml.MotionArrays(root_pos=root_pos, joint_rot=joint_rot)
tensor = pybvh_ml.pack_to_ctv(arrays) # (C, T, V) for a GCN
From there: runtime augmentation in your data loader, PyTorch Datasets with worker-safe per-epoch seeding, and skeleton graph metadata for GCNs — the documentation covers each piece.
Tutorials
Runnable end-to-end notebooks in tutorials/:
- End-to-end pipeline — BVH directory → preprocess →
MotionDatasetwith augmentation → tiny MLP classifier. - Augmentation visualized — every augmentation before/after on a real skeleton, plus
set_epochreproducibility. - Heterogeneous preprocessing — mixing skeletons, frame rates, and up-axes robustly.
Notebooks execute in CI via pytest --nbmake tutorials/, so they can't silently rot.
Stability and versioning
pybvh-ml is in 0.x — expect breaking changes between minor versions.
We treat 0.x as design space: when a past choice turns out to be wrong, we fix it at the root rather than carry scar tissue forward. No deprecation cycles, no compatibility shims; each release ships a single clean migration path, documented in the CHANGELOG. If you depend on pybvh-ml from production code, pin to an exact version (pybvh-ml==0.5.0) and read the upgrade notes before bumping.
This will change at 1.0: from then on, pybvh-ml will commit to strict semver — no breaking changes within a major version, deprecation warnings (at least one minor release) before any future removal. Until 1.0, "make the library better" wins over "preserve the old behavior."
Requirements
- Python >= 3.9
- pybvh >= 0.8.2, < 0.9
- NumPy >= 1.21
Optional: PyTorch >= 2.0 (pip install "pybvh-ml[torch]"), h5py >= 3.0 (pip install "pybvh-ml[hdf5]").
Development
pip install "pybvh-ml[dev]"
pytest tests/ # unit tests
pytest --nbmake tutorials/ # tutorial notebook execution
mkdocs serve # docs preview (pip install "pybvh-ml[docs]")
License
MIT
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 pybvh_ml-0.5.0.tar.gz.
File metadata
- Download URL: pybvh_ml-0.5.0.tar.gz
- Upload date:
- Size: 73.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2981bb9f681c1e807b6a7fa6de7b4e858b7ee51349e55da5565718652eb81067
|
|
| MD5 |
9ff0a6937cc27337f5feddb6ca967443
|
|
| BLAKE2b-256 |
1f2e71b5f752f5e2ad92f52b63c317b560812960ce6a8098cdd8e91465ab00dc
|
Provenance
The following attestation bundles were made for pybvh_ml-0.5.0.tar.gz:
Publisher:
publish.yml on VictorS-67/pybvh-ml
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybvh_ml-0.5.0.tar.gz -
Subject digest:
2981bb9f681c1e807b6a7fa6de7b4e858b7ee51349e55da5565718652eb81067 - Sigstore transparency entry: 2288786327
- Sigstore integration time:
-
Permalink:
VictorS-67/pybvh-ml@702c56564bfef242ab0e1ede86c3f5c25ea106e8 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/VictorS-67
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@702c56564bfef242ab0e1ede86c3f5c25ea106e8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pybvh_ml-0.5.0-py3-none-any.whl.
File metadata
- Download URL: pybvh_ml-0.5.0-py3-none-any.whl
- Upload date:
- Size: 78.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aaffa6e762ea069fff1e02881bb498211bbfad25412a599f05cdef322e7e73ca
|
|
| MD5 |
94d0f74f61e2b0a5744c343f54ff56f0
|
|
| BLAKE2b-256 |
1bf01cf31a7271081b068dc6fb3efddcc55375a31923d54e5222e275f2debfe5
|
Provenance
The following attestation bundles were made for pybvh_ml-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on VictorS-67/pybvh-ml
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybvh_ml-0.5.0-py3-none-any.whl -
Subject digest:
aaffa6e762ea069fff1e02881bb498211bbfad25412a599f05cdef322e7e73ca - Sigstore transparency entry: 2288786423
- Sigstore integration time:
-
Permalink:
VictorS-67/pybvh-ml@702c56564bfef242ab0e1ede86c3f5c25ea106e8 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/VictorS-67
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@702c56564bfef242ab0e1ede86c3f5c25ea106e8 -
Trigger Event:
release
-
Statement type: