MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / __init__

Method __init__

detrsmpl/models/body_models/smpl.py:205–270  ·  view source on GitHub ↗

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 = 'smpl_45',
                 keypoint_dst: str = 'human_data',
                 keypoint_approximate: bool = False,
                 joints_regressor: str = None,
                 extra_joints_regressor: str = None,
                 **kwargs)

Source from the content-addressed store, hash-verified

203class GenderedSMPL(torch.nn.Module):
204 """A wrapper of SMPL to handle gendered inputs."""
205 def __init__(self,
206 *args,
207 keypoint_src: str = 'smpl_45',
208 keypoint_dst: str = 'human_data',
209 keypoint_approximate: bool = False,
210 joints_regressor: str = None,
211 extra_joints_regressor: str = None,
212 **kwargs) -> None:
213 """
214 Args:
215 *args: extra arguments for SMPL initialization.
216 keypoint_src: source convention of keypoints. This convention
217 is used for keypoints obtained from joint regressors.
218 Keypoints then undergo conversion into keypoint_dst
219 convention.
220 keypoint_dst: destination convention of keypoints. This convention
221 is used for keypoints in the output.
222 keypoint_approximate: whether to use approximate matching in
223 convention conversion for keypoints.
224 joints_regressor: path to joint regressor. Should be a .npy
225 file. If provided, replaces the official J_regressor of SMPL.
226 extra_joints_regressor: path to extra joint regressor. Should be
227 a .npy file. If provided, extra joints are regressed and
228 concatenated after the joints regressed with the official
229 J_regressor or joints_regressor.
230 **kwargs: extra keyword arguments for SMPL initialization.
231
232 Returns:
233 None
234 """
235 super(GenderedSMPL, self).__init__()
236
237 assert 'gender' not in kwargs, \
238 self.__class__.__name__ + \
239 'does not need \'gender\' for initialization.'
240
241 self.smpl_neutral = SMPL(*args,
242 gender='neutral',
243 keypoint_src=keypoint_src,
244 keypoint_dst=keypoint_dst,
245 keypoint_approximate=keypoint_approximate,
246 joints_regressor=joints_regressor,
247 extra_joints_regressor=extra_joints_regressor,
248 **kwargs)
249
250 self.smpl_male = SMPL(*args,
251 gender='male',
252 keypoint_src=keypoint_src,
253 keypoint_dst=keypoint_dst,
254 keypoint_approximate=keypoint_approximate,
255 joints_regressor=joints_regressor,
256 extra_joints_regressor=extra_joints_regressor,
257 **kwargs)
258
259 self.smpl_female = SMPL(*args,
260 gender='female',
261 keypoint_src=keypoint_src,
262 keypoint_dst=keypoint_dst,

Callers

nothing calls this directly

Calls 2

SMPLClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected