Spaces:
Running
Running
| from transform3d import transform_body_pose | |
| def run_smpl_fwd_vertices(body_model, | |
| body_transl, | |
| body_orient, body_pose): | |
| """ | |
| Standalone function to run SMPL forward pass.run_smpl_fwd_vertices | |
| Parameters: | |
| - body_model: The SMPL model instance | |
| - body_transl: Translation tensor | |
| - body_orient: Orientation tensor | |
| - body_pose: Pose tensor | |
| - fast: Boolean flag to use fast version | |
| Returns: | |
| - Vertices from the SMPL forward pass | |
| """ | |
| if len(body_transl.shape) > 2: | |
| body_transl = body_transl.flatten(0, 1) | |
| body_orient = body_orient.flatten(0, 1) | |
| body_pose = body_pose.flatten(0, 1) | |
| batch_size = body_transl.shape[0] | |
| body_model.batch_size = batch_size | |
| return body_model( | |
| transl=body_transl, | |
| body_pose=transform_body_pose(body_pose, 'aa->rot'), | |
| global_orient=transform_body_pose(body_orient, 'aa->rot') | |
| ) | |