API reference¶
Public names are exported from body_models, model packages, and backend
modules. See model pages for model-specific APIs.
Model creation¶
body_models.create_model
¶
create_model(model_name, *, runtime='numpy', **kwargs)
Create a model from its public catalog name.
| PARAMETER | DESCRIPTION |
|---|---|
model_name
|
Name returned by :func:
TYPE:
|
runtime
|
Array backend name.
TYPE:
|
**kwargs
|
Model-specific constructor options.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SkinnedModel
|
The requested articulated model. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
body_models.list_models
¶
list_models(*, pattern=None)
List public model factory names.
| PARAMETER | DESCRIPTION |
|---|---|
pattern
|
Optional case-insensitive shell-style pattern such as
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
Sorted matching model names. |
Model contracts¶
Every model provides get_rest_pose(). Models with whole-body presets also
expose get_tpose() and get_apose().
body_models.SkinnedModel
¶
Bases: abc.ABC
Base class for skinned body models.
| METHOD | DESCRIPTION |
|---|---|
apply_pose_correctives |
Apply prepared pose correctives to identity-dependent rest vertices. |
forward_points |
Compute positions defined by a prepared vertex mapping. |
forward_skeleton |
Compute skeleton joint transforms. |
forward_vertices |
Compute mesh vertices. |
get_rest_pose |
Construct canonical parameter defaults from :attr: |
joint_index |
Resolve a common joint to this model's native joint index. |
prepare_point_regressor |
Preproject a vertex mapping for repeated point forwards. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
common_joints |
Common anatomical joints mapped to this model's native joint names.
|
faces |
Mesh face indices. Shape [F, 3] for triangles or [F, 4] for quads.
|
has_face |
bool(x) -> bool
|
has_hands |
bool(x) -> bool
|
joint_names |
Joint names in joint index order.
|
num_joints |
Number of joints in the skeleton.
|
num_vertices |
Number of mesh vertices.
|
parameter_spec |
Machine-readable parameters accepted by this model.
|
parents |
Parent indices in joint_names order, with -1 for the root.
|
pose_joint_indices |
Canonical joints whose local transforms are driven by each pose parameter.
|
rest_vertices |
Mesh vertices in rest pose. Shape [V, 3].
|
runtime |
Array runtime used by this model.
|
skin_weights |
Skinning weights aligned with the public skeleton. Shape [V, J].
|
skinning_spec |
Static topology, render-rig weights, and optional pose correctives.
|
symmetric_joints |
Left/right joint pairs as
|
common_joints
property
¶
common_joints
Common anatomical joints mapped to this model's native joint names.
has_face
class-attribute
¶
has_face = False
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
has_hands
class-attribute
¶
has_hands = False
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
pose_joint_indices
property
¶
pose_joint_indices
Canonical joints whose local transforms are driven by each pose parameter.
skin_weights
property
¶
skin_weights
Skinning weights aligned with the public skeleton. Shape [V, J].
skinning_spec
property
¶
skinning_spec
Static topology, render-rig weights, and optional pose correctives.
symmetric_joints
property
¶
symmetric_joints
Left/right joint pairs as (left_index, right_index), in joint order.
Indices address the J axis of :meth:forward_skeleton outputs and
cover the whole native skeleton, including joints outside the
:class:Joint vocabulary. Unpaired joints lie on the midline. Pairs
describe index correspondence only, not how to mirror a pose.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If a sided joint name has no counterpart. |
apply_pose_correctives
¶
apply_pose_correctives(*, identity, pose)
Apply prepared pose correctives to identity-dependent rest vertices.
forward_points
¶
forward_points(*args, **kwargs)
Compute positions defined by a prepared vertex mapping.
Signatures vary by model. Outputs use the model's native coordinate system and meters.
forward_skeleton
¶
forward_skeleton(*args, **kwargs)
Compute skeleton joint transforms.
Signatures vary by model. Outputs use the model's native coordinate system and meters.
| RETURNS | DESCRIPTION |
|---|---|
Float[Any, '*batch J 4 4']
|
World-space transforms with shape |
forward_vertices
¶
forward_vertices(*args, **kwargs)
Compute mesh vertices.
Signatures vary by model. Outputs use the model's native coordinate system and meters.
| RETURNS | DESCRIPTION |
|---|---|
Float[Any, '*batch V 3']
|
Mesh vertices with shape |
get_rest_pose
¶
get_rest_pose(*, batch_dims=(), dtype=None)
Construct canonical parameter defaults from :attr:parameter_spec.
| PARAMETER | DESCRIPTION |
|---|---|
batch_dims
|
Leading batch dimensions.
TYPE:
|
dtype
|
Optional floating-point dtype.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Float[Any, ...]]
|
Complete model parameters at rest. |
prepare_point_regressor
¶
prepare_point_regressor(mapping)
Preproject a vertex mapping for repeated point forwards.
For Torch, call this after moving the model to its target device.
Mapped points¶
forward_points() evaluates a dense [points, vertices] mapping without
producing the posed mesh. Its vertex dimension must match the model and mesh
simplification. Prepare the regressor after moving a Torch model to its final
device:
import numpy as np
import torch
from body_models.smplx.torch import SMPLX
model = SMPLX(gender="neutral").cuda()
mapping = np.load("captury_J_regressor.npz")["J_regressor"]
regressor = model.prepare_point_regressor(mapping)
params = model.get_rest_pose(batch_dims=(2048,))
with torch.inference_mode():
points = model.forward_points(**params, point_regressor=regressor)
# points.shape == (2048, 67, 3)
Mapped points contain positions; forward_skeleton() returns native joint
transforms. Prepared regressors do not follow later .to() calls.
body_models.PointRegressor
¶
Bases: builtins.dict
A vertex mapping projected through a model's static deformation state.
Parameter and joint metadata¶
ParameterRole is the literal "identity", "pose", or "transform".
RotationType accepts "axis_angle", "quat", "sixd", "matrix", or
"rotmat". matrix is an arbitrary 3×3 transform; rotmat is a proper
SO(3) rotation.
pose_joint_indices maps pose parameters to the distinct canonical joints whose
local transforms they drive. Use these tuples to select skeleton outputs:
hand_indices = model.pose_joint_indices["hand_pose"]
hand_skeleton = model.forward_skeleton(**params, joint_indices=hand_indices)
Indices refer to the full skeleton. Groups may overlap and omit fixed joints.
Changing a local transform also moves descendants outside its group. Rotational
controls map one-to-one to indices in control order: [..., i, :] for vectors,
[..., i, :, :] for matrices.
symmetric_joints lists (left_index, right_index) pairs for symmetry losses
and left/right swaps:
order = list(range(model.num_joints))
for left, right in model.symmetric_joints:
order[left], order[right] = right, left
swapped = model.forward_skeleton(**params)[..., order, :, :]
Pairs cover the native skeleton, including joints outside Joint, such as
SMPL's collars. Unpaired joints lie on the midline. Swapping indices does not
mirror a pose; callers must also reflect rotations in the model's coordinate
frame and parameterization.
body_models.ParameterSpec
¶
ParameterSpec(dims, role, *, default=0.0, rotation_type=None)
body_models.Joint
¶
Bases: enum.StrEnum
Anatomical joint identifiers shared across model-native skeletons.
| ATTRIBUTE | DESCRIPTION |
|---|---|
HEAD |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_ANKLE |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_ELBOW |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_FOOT |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_HIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_INDEX_DIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_INDEX_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_INDEX_PIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_KNEE |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_MIDDLE_DIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_MIDDLE_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_MIDDLE_PIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_PINKY_DIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_PINKY_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_PINKY_PIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_RING_DIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_RING_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_RING_PIP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_SHOULDER |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_THUMB_CMC |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_THUMB_IP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_THUMB_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
LEFT_WRIST |
Anatomical joint identifiers shared across model-native skeletons.
|
NECK |
Anatomical joint identifiers shared across model-native skeletons.
|
PELVIS |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_ANKLE |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_ELBOW |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_FOOT |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_HIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_INDEX_DIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_INDEX_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_INDEX_PIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_KNEE |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_MIDDLE_DIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_MIDDLE_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_MIDDLE_PIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_PINKY_DIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_PINKY_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_PINKY_PIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_RING_DIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_RING_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_RING_PIP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_SHOULDER |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_THUMB_CMC |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_THUMB_IP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_THUMB_MCP |
Anatomical joint identifiers shared across model-native skeletons.
|
RIGHT_WRIST |
Anatomical joint identifiers shared across model-native skeletons.
|
HEAD
class-attribute
¶
HEAD = <Joint.HEAD: 'head'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_ANKLE
class-attribute
¶
LEFT_ANKLE = <Joint.LEFT_ANKLE: 'left_ankle'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_ELBOW
class-attribute
¶
LEFT_ELBOW = <Joint.LEFT_ELBOW: 'left_elbow'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_FOOT
class-attribute
¶
LEFT_FOOT = <Joint.LEFT_FOOT: 'left_foot'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_HIP
class-attribute
¶
LEFT_HIP = <Joint.LEFT_HIP: 'left_hip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_INDEX_DIP
class-attribute
¶
LEFT_INDEX_DIP = <Joint.LEFT_INDEX_DIP: 'left_index_dip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_INDEX_MCP
class-attribute
¶
LEFT_INDEX_MCP = <Joint.LEFT_INDEX_MCP: 'left_index_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_INDEX_PIP
class-attribute
¶
LEFT_INDEX_PIP = <Joint.LEFT_INDEX_PIP: 'left_index_pip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_KNEE
class-attribute
¶
LEFT_KNEE = <Joint.LEFT_KNEE: 'left_knee'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_MIDDLE_DIP
class-attribute
¶
LEFT_MIDDLE_DIP = <Joint.LEFT_MIDDLE_DIP: 'left_middle_dip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_MIDDLE_MCP
class-attribute
¶
LEFT_MIDDLE_MCP = <Joint.LEFT_MIDDLE_MCP: 'left_middle_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_MIDDLE_PIP
class-attribute
¶
LEFT_MIDDLE_PIP = <Joint.LEFT_MIDDLE_PIP: 'left_middle_pip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_PINKY_DIP
class-attribute
¶
LEFT_PINKY_DIP = <Joint.LEFT_PINKY_DIP: 'left_pinky_dip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_PINKY_MCP
class-attribute
¶
LEFT_PINKY_MCP = <Joint.LEFT_PINKY_MCP: 'left_pinky_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_PINKY_PIP
class-attribute
¶
LEFT_PINKY_PIP = <Joint.LEFT_PINKY_PIP: 'left_pinky_pip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_RING_DIP
class-attribute
¶
LEFT_RING_DIP = <Joint.LEFT_RING_DIP: 'left_ring_dip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_RING_MCP
class-attribute
¶
LEFT_RING_MCP = <Joint.LEFT_RING_MCP: 'left_ring_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_RING_PIP
class-attribute
¶
LEFT_RING_PIP = <Joint.LEFT_RING_PIP: 'left_ring_pip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_SHOULDER
class-attribute
¶
LEFT_SHOULDER = <Joint.LEFT_SHOULDER: 'left_shoulder'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_THUMB_CMC
class-attribute
¶
LEFT_THUMB_CMC = <Joint.LEFT_THUMB_CMC: 'left_thumb_cmc'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_THUMB_IP
class-attribute
¶
LEFT_THUMB_IP = <Joint.LEFT_THUMB_IP: 'left_thumb_ip'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_THUMB_MCP
class-attribute
¶
LEFT_THUMB_MCP = <Joint.LEFT_THUMB_MCP: 'left_thumb_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
LEFT_WRIST
class-attribute
¶
LEFT_WRIST = <Joint.LEFT_WRIST: 'left_wrist'>
Anatomical joint identifiers shared across model-native skeletons.
NECK
class-attribute
¶
NECK = <Joint.NECK: 'neck'>
Anatomical joint identifiers shared across model-native skeletons.
PELVIS
class-attribute
¶
PELVIS = <Joint.PELVIS: 'pelvis'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_ANKLE
class-attribute
¶
RIGHT_ANKLE = <Joint.RIGHT_ANKLE: 'right_ankle'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_ELBOW
class-attribute
¶
RIGHT_ELBOW = <Joint.RIGHT_ELBOW: 'right_elbow'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_FOOT
class-attribute
¶
RIGHT_FOOT = <Joint.RIGHT_FOOT: 'right_foot'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_HIP
class-attribute
¶
RIGHT_HIP = <Joint.RIGHT_HIP: 'right_hip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_INDEX_DIP
class-attribute
¶
RIGHT_INDEX_DIP = <Joint.RIGHT_INDEX_DIP: 'right_index_dip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_INDEX_MCP
class-attribute
¶
RIGHT_INDEX_MCP = <Joint.RIGHT_INDEX_MCP: 'right_index_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_INDEX_PIP
class-attribute
¶
RIGHT_INDEX_PIP = <Joint.RIGHT_INDEX_PIP: 'right_index_pip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_KNEE
class-attribute
¶
RIGHT_KNEE = <Joint.RIGHT_KNEE: 'right_knee'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_MIDDLE_DIP
class-attribute
¶
RIGHT_MIDDLE_DIP = <Joint.RIGHT_MIDDLE_DIP: 'right_middle_dip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_MIDDLE_MCP
class-attribute
¶
RIGHT_MIDDLE_MCP = <Joint.RIGHT_MIDDLE_MCP: 'right_middle_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_MIDDLE_PIP
class-attribute
¶
RIGHT_MIDDLE_PIP = <Joint.RIGHT_MIDDLE_PIP: 'right_middle_pip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_PINKY_DIP
class-attribute
¶
RIGHT_PINKY_DIP = <Joint.RIGHT_PINKY_DIP: 'right_pinky_dip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_PINKY_MCP
class-attribute
¶
RIGHT_PINKY_MCP = <Joint.RIGHT_PINKY_MCP: 'right_pinky_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_PINKY_PIP
class-attribute
¶
RIGHT_PINKY_PIP = <Joint.RIGHT_PINKY_PIP: 'right_pinky_pip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_RING_DIP
class-attribute
¶
RIGHT_RING_DIP = <Joint.RIGHT_RING_DIP: 'right_ring_dip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_RING_MCP
class-attribute
¶
RIGHT_RING_MCP = <Joint.RIGHT_RING_MCP: 'right_ring_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_RING_PIP
class-attribute
¶
RIGHT_RING_PIP = <Joint.RIGHT_RING_PIP: 'right_ring_pip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_SHOULDER
class-attribute
¶
RIGHT_SHOULDER = <Joint.RIGHT_SHOULDER: 'right_shoulder'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_THUMB_CMC
class-attribute
¶
RIGHT_THUMB_CMC = <Joint.RIGHT_THUMB_CMC: 'right_thumb_cmc'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_THUMB_IP
class-attribute
¶
RIGHT_THUMB_IP = <Joint.RIGHT_THUMB_IP: 'right_thumb_ip'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_THUMB_MCP
class-attribute
¶
RIGHT_THUMB_MCP = <Joint.RIGHT_THUMB_MCP: 'right_thumb_mcp'>
Anatomical joint identifiers shared across model-native skeletons.
RIGHT_WRIST
class-attribute
¶
RIGHT_WRIST = <Joint.RIGHT_WRIST: 'right_wrist'>
Anatomical joint identifiers shared across model-native skeletons.
Runtimes¶
RuntimeName accepts "numpy", "torch", or "jax". KernelBackend selects
"torch" or "warp" kernels for Torch models.
body_models.ArrayRuntime
¶
Bases: abc.ABC
Shared numerical operations for one array backend.
| METHOD | DESCRIPTION |
|---|---|
asarray |
Create an array with the backend, device, and default dtype of |
stop_gradient |
Return |
to_numpy |
Convert an array to NumPy host memory. |
zeros |
Create zeros with the backend and device of |
| ATTRIBUTE | DESCRIPTION |
|---|---|
xp |
Array namespace for this runtime.
|
asarray
¶
asarray(value, *, like, dtype=None)
Create an array with the backend, device, and default dtype of like.
Prepared skinning¶
Identity and pose records are TypedDicts. SkinningSpec is a dataclass.
| Contract | Contents |
|---|---|
SkinningIdentity |
Identity-dependent rest_vertices. |
LinearIdentity |
Rest vertices, rest joints, and local joint offsets. |
SkinningPose |
skeleton_transforms, skinning_transforms, optional compact pose_coefficients. |
SkinningSpec |
Triangles, weights aligned with skinning transforms, optional dense/sparse corrective basis. |
Arrays retain arbitrary leading batch dimensions. Corrective bases implement
pose_offsets = basis.apply(pose_coefficients). Coefficient meanings are
model-specific; use model.apply_pose_correctives(identity=identity, pose=pose)
to expand them without depending on the representation. Model packages export
*Identity types only for additional fields; all models share SkinningPose.
body_models.LinearIdentity
¶
Bases: builtins.dict
Identity-dependent joints and vertices from linear bases.
body_models.SkinningSpec
¶
SkinningSpec(triangles, skinning_weights, corrective_basis=None)
Model-static data consumed by linear blend skinning renderers.
body_models.DenseCorrectiveBasis
¶
DenseCorrectiveBasis(values)
Dense corrective basis stored as [coefficients, vertex coordinates].