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

Method __init__

detrsmpl/models/body_models/smplx.py:266–317  ·  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 = 'smplx',
                 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

264 NUM_FACES = 20908
265
266 def __init__(self,
267 *args,
268 keypoint_src: str = 'smplx',
269 keypoint_dst: str = 'human_data',
270 keypoint_approximate: bool = False,
271 joints_regressor: str = None,
272 extra_joints_regressor: str = None,
273 **kwargs):
274 """
275 Args:
276 *args: extra arguments for SMPL initialization.
277 keypoint_src: source convention of keypoints. This convention
278 is used for keypoints obtained from joint regressors.
279 Keypoints then undergo conversion into keypoint_dst
280 convention.
281 keypoint_dst: destination convention of keypoints. This convention
282 is used for keypoints in the output.
283 keypoint_approximate: whether to use approximate matching in
284 convention conversion for keypoints.
285 joints_regressor: path to joint regressor. Should be a .npy
286 file. If provided, replaces the official J_regressor of SMPL.
287 extra_joints_regressor: path to extra joint regressor. Should be
288 a .npy file. If provided, extra joints are regressed and
289 concatenated after the joints regressed with the official
290 J_regressor or joints_regressor.
291 **kwargs: extra keyword arguments for SMPL initialization.
292
293 Returns:
294 None
295 """
296 super(SMPLXLayer, self).__init__(*args, **kwargs)
297 # joints = [JOINT_MAP[i] for i in JOINT_NAMES]
298 self.keypoint_src = keypoint_src
299 self.keypoint_dst = keypoint_dst
300 self.keypoint_approximate = keypoint_approximate
301
302 # override the default SMPL joint regressor if available
303 if joints_regressor is not None:
304 joints_regressor = torch.tensor(np.load(joints_regressor),
305 dtype=torch.float)
306 self.register_buffer('joints_regressor', joints_regressor)
307
308 # allow for extra joints to be regressed if available
309 if extra_joints_regressor is not None:
310 joints_regressor_extra = torch.tensor(
311 np.load(extra_joints_regressor), dtype=torch.float)
312 self.register_buffer('joints_regressor_extra',
313 joints_regressor_extra)
314
315 self.num_verts = self.get_num_verts()
316 self.num_joints = get_keypoint_num(convention=self.keypoint_dst)
317 self.body_part_segmentation = body_segmentation('smplx')
318
319 def forward(self,
320 *args,

Callers

nothing calls this directly

Calls 5

get_keypoint_numFunction · 0.90
body_segmentationClass · 0.90
get_num_vertsMethod · 0.80
__init__Method · 0.45
loadMethod · 0.45

Tested by

no test coverage detected