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)
| 350 | |
| 351 | |
| 352 | def 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 | |
| 387 | def get_keypoint_num(convention: str = 'smplx', |
no outgoing calls
no test coverage detected