Skip to content

API reference

This page covers the interface every model shares. Model-specific options are on each model page.

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:list_models. Names are case-insensitive, and underscores are treated as hyphens.

TYPE: str

runtime

Array backend name.

TYPE: Literal DEFAULT: 'numpy'

**kwargs

Model-specific constructor options.

TYPE: Any

RETURNS DESCRIPTION
SkinnedModel

The requested articulated model.

RAISES DESCRIPTION
ValueError

If model_name is unknown.

body_models.list_models

list_models(*, pattern=None)

List public model factory names.

PARAMETER DESCRIPTION
pattern

Optional case-insensitive shell-style pattern such as "smpl*".

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
list[str]

Sorted matching model names.

Models

Every model provides get_rest_pose(); whole-body models also provide 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:parameter_spec.

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 (left_index, right_index), in joint order.

common_joints property

common_joints

Common anatomical joints mapped to this model's native joint names.

faces property

faces

Mesh face indices. Shape [F, 3] for triangles or [F, 4] for quads.

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.

joint_names property

joint_names

Joint names in joint index order.

num_joints property

num_joints

Number of joints in the skeleton.

num_vertices property

num_vertices

Number of mesh vertices.

parameter_spec property

parameter_spec

Machine-readable parameters accepted by this model.

parents property

parents

Parent indices in joint_names order, with -1 for the root.

pose_joint_indices property

pose_joint_indices

Canonical joints whose local transforms are driven by each pose parameter.

rest_vertices property

rest_vertices

Mesh vertices in rest pose. Shape [V, 3].

runtime property

runtime

Array runtime used by this model.

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 [*batch, J, 4, 4] in meters.

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 [*batch, V, 3] in meters.

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: tuple[int, ...] DEFAULT: ()

dtype

Optional floating-point dtype.

TYPE: Any | None DEFAULT: None

RETURNS DESCRIPTION
dict[str, Float[Any, ...]]

Complete model parameters at rest.

joint_index

joint_index(joint)

Resolve a common joint to this model's native joint index.

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, such as a marker or joint regressor, without building the posed mesh. The vertex count must match the model, including any mesh simplification.

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)

A prepared regressor stays on the device it was prepared on, so prepare it after moving the model. Mapped points are positions; forward_skeleton() returns joint transforms.

body_models.PointRegressor

Bases: builtins.dict

A vertex mapping projected through a model's static deformation state.

Parameters and joints

ParameterRole is "identity", "pose", or "transform". RotationType is "axis_angle", "quat", "sixd", "matrix" (any 3×3 transform), or "rotmat" (a proper SO(3) rotation).

pose_joint_indices maps each pose parameter to the joints whose local transforms it drives. Rotational controls follow the same order, so control i ([..., i, :], or [..., i, :, :] for matrices) drives joint indices[i]:

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, and a control also moves its joint's descendants outside the group.

symmetric_joints lists (left, right) index pairs over the whole native skeleton, including joints outside Joint; unpaired joints lie on the midline. Use it for symmetry losses or 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, :, :]

Swapping indices does not mirror a pose: the rotations must also be reflected in the model's frame and parameterization.

body_models.ParameterSpec

ParameterSpec(dims, role, *, default=0.0, rotation_type=None)

Array dims, role, and numeric default of one model parameter.

METHOD DESCRIPTION
rotation

Describe one rotation or a vector of rotations.

ATTRIBUTE DESCRIPTION
default

Convert a string or number to a floating point number, if possible.

default class-attribute

default = 0.0

Convert a string or number to a floating point number, if possible.

rotation classmethod

rotation(rotation_type, *, count=None, role='pose')

Describe one rotation or a vector of rotations.

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 is "numpy", "torch", or "jax". For Torch models, KernelBackend selects "torch" or "warp" kernels.

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 like.

stop_gradient

Return value without gradient propagation.

to_numpy

Convert an array to NumPy host memory.

zeros

Create zeros with the backend and device of like.

ATTRIBUTE DESCRIPTION
xp

Array namespace for this runtime.

xp property

xp

Array namespace for this runtime.

asarray

asarray(value, *, like, dtype=None)

Create an array with the backend, device, and default dtype of like.

stop_gradient

stop_gradient(value)

Return value without gradient propagation.

to_numpy

to_numpy(value)

Convert an array to NumPy host memory.

zeros

zeros(shape, *, like, dtype=None)

Create zeros with the backend and device of like.

Prepared skinning

Each model's prepare_identity() and prepare_pose() return the intermediate records behind forward_vertices(). Pass a prepared identity to reuse it across poses. skinning_spec holds the static data used for skinning.

Type Contents
SkinningIdentity Identity-dependent rest_vertices.
LinearIdentity Rest vertices, rest joints, and local joint offsets.
SkinningPose Skeleton and skinning transforms, and optional compact pose_coefficients.
SkinningSpec Triangles, skinning weights, and an optional dense or sparse corrective basis.

Identity and pose records are TypedDicts; SkinningSpec is a dataclass. All keep the leading batch dimensions. Model packages export their own *Identity type only when it adds fields; every model uses SkinningPose.

Pose coefficients are model-specific. Expand them with model.apply_pose_correctives(identity=identity, pose=pose) rather than depending on the basis representation.

SkinningSpec.skinning_weights follow the render rig, which can differ from the public skeleton that skin_weights follows.

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].

body_models.SparseCorrectiveBasis

SparseCorrectiveBasis(linear)

Sparse corrective basis backed by the active array runtime.

METHOD DESCRIPTION
to_coo

Return the basis in coordinate format without densifying it.

to_coo

to_coo()

Return the basis in coordinate format without densifying it.