Args: *args: extra arguments for SMPL initialization. keypoint_src: source convention of keypoints. This convention is used for keypoints obtained from joint regressors. Keypoints then undergo conversion into keypoint_dst
(self,
*args,
keypoint_src: str = 'smplx',
keypoint_dst: str = 'human_data',
keypoint_approximate: bool = False,
joints_regressor: str = None,
extra_joints_regressor: str = None,
**kwargs)
| 25 | NUM_FACES = 20908 |
| 26 | |
| 27 | def __init__(self, |
| 28 | *args, |
| 29 | keypoint_src: str = 'smplx', |
| 30 | keypoint_dst: str = 'human_data', |
| 31 | keypoint_approximate: bool = False, |
| 32 | joints_regressor: str = None, |
| 33 | extra_joints_regressor: str = None, |
| 34 | **kwargs): |
| 35 | """ |
| 36 | Args: |
| 37 | *args: extra arguments for SMPL initialization. |
| 38 | keypoint_src: source convention of keypoints. This convention |
| 39 | is used for keypoints obtained from joint regressors. |
| 40 | Keypoints then undergo conversion into keypoint_dst |
| 41 | convention. |
| 42 | keypoint_dst: destination convention of keypoints. This convention |
| 43 | is used for keypoints in the output. |
| 44 | keypoint_approximate: whether to use approximate matching in |
| 45 | convention conversion for keypoints. |
| 46 | joints_regressor: path to joint regressor. Should be a .npy |
| 47 | file. If provided, replaces the official J_regressor of SMPL. |
| 48 | extra_joints_regressor: path to extra joint regressor. Should be |
| 49 | a .npy file. If provided, extra joints are regressed and |
| 50 | concatenated after the joints regressed with the official |
| 51 | J_regressor or joints_regressor. |
| 52 | **kwargs: extra keyword arguments for SMPL initialization. |
| 53 | |
| 54 | Returns: |
| 55 | None |
| 56 | """ |
| 57 | super(SMPLX, self).__init__(*args, **kwargs) |
| 58 | # joints = [JOINT_MAP[i] for i in JOINT_NAMES] |
| 59 | self.keypoint_src = keypoint_src |
| 60 | self.keypoint_dst = keypoint_dst |
| 61 | self.keypoint_approximate = keypoint_approximate |
| 62 | |
| 63 | # override the default SMPL joint regressor if available |
| 64 | if joints_regressor is not None: |
| 65 | joints_regressor = torch.tensor(np.load(joints_regressor), |
| 66 | dtype=torch.float) |
| 67 | self.register_buffer('joints_regressor', joints_regressor) |
| 68 | |
| 69 | # allow for extra joints to be regressed if available |
| 70 | if extra_joints_regressor is not None: |
| 71 | joints_regressor_extra = torch.tensor( |
| 72 | np.load(extra_joints_regressor), dtype=torch.float) |
| 73 | self.register_buffer('joints_regressor_extra', |
| 74 | joints_regressor_extra) |
| 75 | |
| 76 | self.num_verts = self.get_num_verts() |
| 77 | self.num_joints = get_keypoint_num(convention=self.keypoint_dst) |
| 78 | self.body_part_segmentation = body_segmentation('smplx') |
| 79 | |
| 80 | def forward(self, |
| 81 | *args, |
no test coverage detected