SOMA¶
SOMA implements SOMA-X identity, pose, and corrective controls without requiring
py-soma-x.
Setup¶
SOMA downloads automatically on first use from the
abcamiletto/body-models
Hugging Face repository, which records the SOMA-X Apache 2.0 provenance.
To prefetch:
body-models download soma
The loader requires normalized assets, as provided by the hosted archive. To normalize upstream SOMA-X 0.2.1 assets and save their path:
body-models preprocess-soma /path/to/upstream /path/to/processed
SOMA exposes 77 public joints and uses an internal twist-joint rig for skinning.
The lod options "mid", "low", and "xlo" have 18,056, 4,505, and 612
vertices, respectively.
prepare_identity() defaults to repose=True, bind_pose="fit", matching
SOMA-X. Use repose=False to retain the fitted rest shape and skeleton,
bind_pose="fit_detached" to stop gradients through fitting, or
bind_pose="canonical" for the canonical bind pose.
API¶
body_models.soma.numpy.SOMA
¶
SOMA(
*,
model_path=None,
model_type="soma",
lod="mid",
rotation_type="axis_angle",
simplify=1.0,
)
Bases: body_models.soma._model.SOMA
Native SOMA-X model with identity, pose, and corrective controls.
| 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 posed public-joint transforms in meters. |
forward_vertices |
Compute posed mesh vertices in meters. |
get_rest_pose |
Return zero pose controls and the model's default identity. |
joint_index |
Resolve a common joint to this model's native joint index. |
prepare_point_regressor |
Preproject a vertex mapping for repeated point forwards. |
get_apose |
Return the SOMA A-pose. |
get_tpose |
Return the SOMA T-pose. |
prepare_identity |
Precompute identity-dependent state for repeated forward passes. |
prepare_pose |
Precompute pose-dependent state for repeated forward passes. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
common_joints |
Common anatomical joints mapped to this model's native joint names.
|
has_face |
bool(x) -> bool
|
has_hands |
bool(x) -> bool
|
num_joints |
Number of joints in the skeleton.
|
pose_joint_indices |
Canonical joints whose local transforms are driven by each pose parameter.
|
runtime |
Array runtime used by this model.
|
skinning_spec |
Static topology, render-rig weights, and optional pose correctives.
|
symmetric_joints |
Left/right joint pairs as
|
NUM_BODY_CONTROLS |
int([x]) -> integer
|
NUM_HAND_CONTROLS |
int([x]) -> integer
|
NUM_HEAD_CONTROLS |
int([x]) -> integer
|
NUM_JOINTS |
int([x]) -> integer
|
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 = True
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.
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. |
NUM_BODY_CONTROLS
class-attribute
¶
NUM_BODY_CONTROLS = 23
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
NUM_HAND_CONTROLS
class-attribute
¶
NUM_HAND_CONTROLS = 48
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
NUM_HEAD_CONTROLS
class-attribute
¶
NUM_HEAD_CONTROLS = 5
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
NUM_JOINTS
class-attribute
¶
NUM_JOINTS = 77
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
apply_pose_correctives
¶
apply_pose_correctives(*, identity, pose)
Apply prepared pose correctives to identity-dependent rest vertices.
Source code in src/body_models/_base.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
forward_points
¶
forward_points(
body_pose,
head_pose,
hand_pose,
*,
point_regressor,
shape=None,
scale_params=None,
identity=None,
global_rotation=None,
global_translation=None,
)
Compute positions defined by a prepared vertex mapping.
Source code in src/body_models/soma/_model.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
forward_skeleton
¶
forward_skeleton(
body_pose,
head_pose,
hand_pose,
*,
shape=None,
scale_params=None,
identity=None,
global_rotation=None,
global_translation=None,
joint_indices=None,
)
Compute posed public-joint transforms in meters.
Source code in src/body_models/soma/_model.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
forward_vertices
¶
forward_vertices(
body_pose,
head_pose,
hand_pose,
*,
shape=None,
scale_params=None,
identity=None,
global_rotation=None,
global_translation=None,
vertex_indices=None,
)
Compute posed mesh vertices in meters.
Source code in src/body_models/soma/_model.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
get_rest_pose
¶
get_rest_pose(*, batch_dims=(), dtype=None, hands='default')
Return zero pose controls and the model's default identity.
Source code in src/body_models/soma/_model.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
joint_index
¶
joint_index(joint)
Resolve a common joint to this model's native joint index.
Source code in src/body_models/_base.py
173 174 175 176 177 178 179 180 181 | |
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.
Source code in src/body_models/_base.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
get_apose
¶
get_apose(*, batch_dims=(), dtype=None, hands='default')
Return the SOMA A-pose.
Source code in src/body_models/soma/_model.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
get_tpose
¶
get_tpose(*, batch_dims=(), dtype=None, hands='default')
Return the SOMA T-pose.
Source code in src/body_models/soma/_model.py
405 406 407 408 409 410 411 412 413 | |
prepare_identity
¶
prepare_identity(
shape, *, scale_params=None, repose=True, bind_pose="fit"
)
Precompute identity-dependent state for repeated forward passes.
Source code in src/body_models/soma/_model.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
prepare_pose
¶
prepare_pose(body_pose, head_pose, hand_pose, *, identity)
Precompute pose-dependent state for repeated forward passes.
Source code in src/body_models/soma/_model.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |