keypoints_to_lengths
- hybrid_learning.datasets.custom.person_size_estimation.keypoints_to_lengths(kpts, includes=None, 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])[source]
Estimate different skeletal lengths from given 2D joint coordinates. Due to 2D projection, the maximum estimate is returned for any body part. Joints may be marked as excluded from calculation by mapping their bool value to
False
or 0 inincludes
(e.g. use to exclude keypoints which are not in an image).To infer the length of body parts for which information is missing, the given
factors
and further relations listed below are used. It is assumed thatfactors
represents parameters to linearly estimate the same size (not necessarily the body size) from different body part sizes. Further used approximate relations from arts best-practice:head width (see https://www.makingcomics.com/2014/01/19/standard-proportions-human-body/):
head width ~ 5 eye widths
the space between 2 eyes ~ 1 eye width
head depth (including nose):
head depth ~ \(2\times\) ear-to-eye (see https://www.artistsnetwork.com/art-mediums/drawing-human-head/)
4/7 head depth ~ ear-to-nose (see https://www.artyfactory.com/portraits/pencil-portraits/proportions-of-a-head.html)
head height (see https://www.artyfactory.com/portraits/pencil-portraits/proportions-of-a-head.html):
head height ~ \(\frac{3}{2}\) head width (however, height width is often overestimated due to the quality of ear keypoints, therefore a factor of 1.1 is taken instead)
head height ~ \(\frac{8}{7}\) head depth (including nose)
Estimated lengths (index of returned
pandas.Series
): long bones (see_lengths_of_long_bones()
), hip_to_shoulder, arm, leg, shoulder_width, wrist_to_wrist, body_height, head_width, head_heightAssumed given joint names: left_ear, right_ear, left_eye, right_eye, nose, and those needed by
_lengths_of_long_bones()
- Parameters
kpts (Mapping[str, ndarray]) – mapping of joint identifier to x-y-coordinate
includes (Optional[Mapping[str, Union[bool, int]]]) – mapping of joint identifier to bool stating whether to assume the joint information as known and include the joint in calculations; see
_length_of_links()
factors – parameter information of the same form as
FACTORS
; it is not required that the linear formulas represented there calculate the body height, but they must all calculate the same size estimate
- Returns
a
pandas.Series
with the length identifier as index names and the float lengths as values- Return type