to_keypoint_idxs

hybrid_learning.datasets.custom.coco.keypoints_processing.to_keypoint_idxs(keypoint_names, coco=None, all_keypoint_names=('nose', 'left_eye', 'right_eye', 'left_ear', 'right_ear', 'left_shoulder', 'right_shoulder', 'left_elbow', 'right_elbow', 'left_wrist', 'right_wrist', 'left_hip', 'right_hip', 'left_knee', 'right_knee', 'left_ankle', 'right_ankle'))[source]

Return the start indices for the given keypoints within an annotations 'keypoint' field.

Keypoints

{keypt_name1: (x1,y1,visibility1), keypt_name2: (...), ...}

are in COCO annotated as a list of

[x1, y1, visibility1,   x2, y2, ...]

This method returns the index of the x-coordinates within the annotation list. To obtain the mapping from keypoints to keypoint indices, either directly specify the list of keypoint names or provide the coco instance to retrieve it from.

Parameters
  • keypoint_names (Iterable[str]) – list of keypoint names to collect the start indices for

  • all_keypoint_names – mapping of keypoint names to keypoint indices (3x their index in the list)

  • coco (Optional[COCO]) – coco handler from which to retrieve mapping of keypoint names to keypoint indices (overrides all_keypoint_names)

Returns

list with the start indices for the given keypoints

Return type

List[int]