in contactopt/util.py [0:0]
def forward_mano(mano_model, pose, beta, tforms):
"""Forward mano pass, MANO params to mesh"""
device = pose.device
batch_size = pose.shape[0]
verts, joints = mano_model(pose, beta)
verts_homo = torch.cat((verts / 1000, torch.ones(batch_size, verts.shape[1], 1, device=device)), 2)
joints_homo = torch.cat((joints / 1000, torch.ones(batch_size, joints.shape[1], 1, device=device)), 2)
tform_agg = torch.eye(4, device=device).reshape(1, 4, 4).repeat(batch_size, 1, 1)
for tform in tforms:
tform_agg = torch.bmm(tform, tform_agg) # Aggregate all transforms
# Apply aggregated transform to all points, permuting for matmul
verts_homo = torch.bmm(tform_agg, verts_homo.permute(0, 2, 1)).permute(0, 2, 1)
joints_homo = torch.bmm(tform_agg, joints_homo.permute(0, 2, 1)).permute(0, 2, 1)
return verts_homo[:, :, :3], joints_homo[:, :, :3]