(self,
betas: Optional[Tensor] = None,
global_orient: Optional[Tensor] = None,
body_pose: Optional[Tensor] = None,
left_hand_pose: Optional[Tensor] = None,
right_hand_pose: Optional[Tensor] = None,
transl: Optional[Tensor] = None,
return_verts: bool = True,
return_full_pose: bool = False,
pose2rot: bool = True,
**kwargs)
| 737 | **kwargs) |
| 738 | |
| 739 | def forward(self, |
| 740 | betas: Optional[Tensor] = None, |
| 741 | global_orient: Optional[Tensor] = None, |
| 742 | body_pose: Optional[Tensor] = None, |
| 743 | left_hand_pose: Optional[Tensor] = None, |
| 744 | right_hand_pose: Optional[Tensor] = None, |
| 745 | transl: Optional[Tensor] = None, |
| 746 | return_verts: bool = True, |
| 747 | return_full_pose: bool = False, |
| 748 | pose2rot: bool = True, |
| 749 | **kwargs) -> SMPLHOutput: |
| 750 | """""" |
| 751 | device, dtype = self.shapedirs.device, self.shapedirs.dtype |
| 752 | if global_orient is None: |
| 753 | batch_size = 1 |
| 754 | global_orient = torch.zeros(3, device=device, dtype=dtype).view( |
| 755 | 1, 1, 3).expand(batch_size, -1, -1).contiguous() |
| 756 | else: |
| 757 | batch_size = global_orient.shape[0] |
| 758 | if body_pose is None: |
| 759 | body_pose = torch.zeros(3, device=device, dtype=dtype).view( |
| 760 | 1, 1, 3).expand(batch_size, 21, -1).contiguous() |
| 761 | if left_hand_pose is None: |
| 762 | left_hand_pose = torch.zeros(3, device=device, dtype=dtype).view( |
| 763 | 1, 1, 3).expand(batch_size, 15, -1).contiguous() |
| 764 | if right_hand_pose is None: |
| 765 | right_hand_pose = torch.zeros(3, device=device, dtype=dtype).view( |
| 766 | 1, 1, 3).expand(batch_size, 15, -1).contiguous() |
| 767 | if betas is None: |
| 768 | betas = torch.zeros([batch_size, self.num_betas], |
| 769 | dtype=dtype, |
| 770 | device=device) |
| 771 | if transl is None: |
| 772 | transl = torch.zeros([batch_size, 3], dtype=dtype, device=device) |
| 773 | |
| 774 | # Concatenate all pose vectors |
| 775 | full_pose = torch.cat([ |
| 776 | global_orient.reshape(-1, 1, 3), |
| 777 | body_pose.reshape(-1, self.NUM_BODY_JOINTS, 3), |
| 778 | left_hand_pose.reshape(-1, self.NUM_HAND_JOINTS, 3), |
| 779 | right_hand_pose.reshape(-1, self.NUM_HAND_JOINTS, 3) |
| 780 | ], |
| 781 | dim=1) |
| 782 | |
| 783 | vertices, joints = lbs(betas, |
| 784 | full_pose, |
| 785 | self.v_template, |
| 786 | self.shapedirs, |
| 787 | self.posedirs, |
| 788 | self.J_regressor, |
| 789 | self.parents, |
| 790 | self.lbs_weights, |
| 791 | pose2rot=True) |
| 792 | |
| 793 | # Add any extra joints that might be needed |
| 794 | joints = self.vertex_joint_selector(vertices, joints) |
| 795 | if self.joint_mapper is not None: |
| 796 | joints = self.joint_mapper(joints) |
nothing calls this directly
no test coverage detected