File size: 983 Bytes
517683d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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')
    )