fit#

smplfitter.np.BodyFitter.fit(target_vertices, target_joints=None, vertex_weights=None, joint_weights=None, num_iter=1, beta_regularizer=1, beta_regularizer2=0, scale_regularizer=0, kid_regularizer=None, share_beta=False, final_adjust_rots=True, scale_target=False, scale_fit=False, initial_pose_rotvecs=None, initial_shape_betas=None, initial_kid_factor=None, allow_nan=True, requested_keys=('pose_rotvecs',))[source]#

Fits the body model to target vertices and optionally joints by optimizing for shape and pose, and optionally others.

Parameters:
  • target_vertices – Target mesh vertices, shaped as (batch_size, num_vertices, 3).

  • target_joints – Target joint locations, shaped as (batch_size, num_joints, 3).

  • vertex_weights – Importance weights for each vertex during the fitting process.

  • joint_weights – Importance weights for each joint during the fitting process.

  • num_iter – Number of iterations for the optimization process. Reasonable values are in the range of 1-4.

  • beta_regularizer – L2 regularization weight for shape parameters (betas). Set small for easy poses and extreme body shapes, set high for harder poses and non-extreme body shape. (Good choices can be 0, 0.1, 1, 10.)

  • beta_regularizer2 – Secondary regularization for betas, affecting the first two parameters. Often zero works well.

  • scale_regularizer – Regularization term to penalize the scale factor deviating from 1. Has no effect unless scale_target or scale_fit is True.

  • kid_regularizer – Regularization weight for the kid blendshape factor. Has no effect unless enable_kid on the object is True.

  • share_beta – If True, shares the shape parameters (betas) across instances in the batch.

  • final_adjust_rots – Whether to perform a final refinement of the body part orientations to improve alignment.

  • scale_target – If True, estimates a scale factor to apply to the target vertices for alignment.

  • scale_fit – If True, estimates a scale factor to apply to the fitted mesh for alignment.

  • initial_kid_factor – Same as above, but for the kid blendshape factor.

  • requested_keys – List of keys specifying which results to return.

Returns:

A dictionary containing the following items, based on requested keys
  • pose_rotvecs – Estimated pose in concatenated rotation vector format.

  • shape_betas – Estimated shape parameters (betas).

  • trans – Estimated translation parameters.

  • joints – Estimated joint positions, if requested.

  • vertices – Fitted mesh vertices, if requested.

  • orientations – Global body part orientations as rotation matrices.

  • relative_orientations – Parent-relative body part orientations as rotation matrices.

  • kid_factor – Estimated kid blendshape factor, if enable_kid is True.

  • scale_corr – Estimated scale correction factor, if scale_target or scale_fit is True.