person_has_rel_size

hybrid_learning.datasets.custom.coco.keypoints_processing.person_has_rel_size(img_meta, ann, min_rel_height=None, max_rel_height=None, img_target_size=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'), assumed_height=1.7, factors=           bbox_width  bbox_height  ...  upper_arm  lower_arm slope               1            1  ...     3.7200     4.4600 intersect           0            0  ...     0.4486     0.5694  [2 rows x 11 columns], use_bbox_info=False)[source]

Check whether the relative size of the person described by annotation ann wrt image size is in specified range. If img_target_size is given, it is assumed the image is padded before heights are compared (i.e. either height or width are increased until the same ratio is achieved as for img_target_size). The size of the person is the maximum total height estimated using annotation_to_sizes().

Parameters
  • img_meta (Dict[str, Any]) – the image meta data containing the image size info; the dict must at least contain {"width": img_width, "height": img_height} describing the dimensions to which the annotation currently applies

  • ann (Dict[str, Any]) – the annotation with the keypoint data for the person

  • min_rel_height (Optional[float]) – the lower bound for the relative height

  • max_rel_height (Optional[float]) – the upper bound for the relative height

  • img_target_size (Optional[Tuple[int, int]]) – target image size (height, width) in pixels; if this is given, it is assumed that the image is padded to the ratio specified by the given size before applying the height ratio check between image and person height

  • all_keypoint_names (Sequence[str]) – see annotation_to_sizes()

  • assumed_height – see annotation_to_sizes()

  • factors – see annotation_to_sizes()

  • use_bbox_info (bool) – whether to use the bounding box information; see annotation_to_tot_height() for details

Returns

whether the relative height of the person to the image height is within the given bounds (possibly scaling the annotation if required); None if the person height could not be determined

Return type

Optional[bool]