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

Function get_keypoint_idx

detrsmpl/core/conventions/keypoints_mapping/__init__.py:352–384  ·  view source on GitHub ↗

Get keypoint index from specified convention with keypoint name. Args: name (str): keypoint name convention (str): data type from keypoints_factory. approximate (bool): control whether approximate mapping is allowed. keypoints_factory (dict, optional): A class to

(name: str,
                     convention: str = 'smplx',
                     approximate: bool = False,
                     keypoints_factory: dict = KEYPOINTS_FACTORY)

Source from the content-addressed store, hash-verified

350
351
352def get_keypoint_idx(name: str,
353 convention: str = 'smplx',
354 approximate: bool = False,
355 keypoints_factory: dict = KEYPOINTS_FACTORY) -> List[int]:
356 """Get keypoint index from specified convention with keypoint name.
357
358 Args:
359 name (str): keypoint name
360 convention (str): data type from keypoints_factory.
361 approximate (bool): control whether approximate mapping is allowed.
362 keypoints_factory (dict, optional): A class to store the attributes.
363 Defaults to keypoints_factory.
364 Returns:
365 List[int]: keypoint index
366 """
367 keypoints = keypoints_factory[convention]
368 try:
369 idx = keypoints.index(name)
370 except ValueError:
371 idx = -1 # not matched
372 if approximate and idx == -1:
373 try:
374 part_list = human_data.APPROXIMATE_MAP[name]
375 except KeyError:
376 return idx
377 for approximate_name in part_list:
378 try:
379 idx = keypoints.index(approximate_name)
380 except ValueError:
381 idx = -1
382 if idx >= 0:
383 return idx
384 return idx
385
386
387def get_keypoint_num(convention: str = 'smplx',

Callers 15

__call__Method · 0.90
_parse_resultMethod · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
_set_keypoint_idxsMethod · 0.90
_set_keypoint_idxsMethod · 0.90
loss_smpl_kp3dMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected