lengths_to_body_size

hybrid_learning.datasets.custom.person_size_estimation.lengths_to_body_size(lengths, 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], assumed_height=1.7)[source]

Estimate the body size in pixels given anatomical lengths in pixels, the assumed_height and formula factors in meters.

Assume a person of height \(h = \text{assumed\_height}\) in meters is scaled by a factor \(f\) to a height of \(h'\) pixels. The following is given:

  • From factors: The formula \(h(l) = l \cdot s + c\) to calculate the total body size in meters of a person from an anatomical size \(l\) in meters with given slope \(s\) and intersect \(c\).

  • From lengths: The value \(l' = f \cdot l\) of the anatomical size \(l\) scaled by \(f\).

  • The value of \(h(l)\) (in meters) is assumed to be assumed_height.

The goal is to find the scaled size \(f\cdot h(l)\). This is given by the formula

\[\begin{split}f \cdot h(l) = f\cdot (l \cdot s + c) = l'\cdot s + f \cdot c \\ \Rightarrow f = \frac{l'}{h(l) - c} \\ \Rightarrow f \cdot h(l) = l' \cdot \frac{h(l)}{h(l) - c}\end{split}\]
Parameters
  • lengths (Mapping[str, float]) – mapping of anatomic length identifiers to floats

  • factors – mapping of anatomic length identifier to parameters for linear formula to calculate the body size in meters

  • assumed_height (float) – the assumed height of the person in meters

Returns

a mapping of anatomic length to body height estimated from its value and formula; if an anatomic length is not given (missing from lengths or None), its total size return value is None