pose_format.pose module

Classes:

Pose(header, body)

File IO for '.pose' file format, including the header and body.

class pose_format.pose.Pose(header, body)[source]

Bases: object

File IO for ‘.pose’ file format, including the header and body.

Parameters:
  • header (PoseHeader) – Header information for the pose.

  • body (PoseBody) – Body data for the pose.

Methods:

bbox()

Calculates bounding box for Pose.

focus()

Gets the pose to start at (0,0) and have dimensions as big as needed

frame_dropout_normal([dropout_mean, dropout_std])

Normal frame dropout on Pose.

frame_dropout_uniform([dropout_min, dropout_max])

Perform uniform frame dropout on Pose

get_components(components[, points])

get pose components based on criteria.

normalize(info[, scale_factor])

Normalize the points to a fixed distance between two particular points.

normalize_distribution([mu, std, axis])

Normalize points distribution.

read(buffer[, pose_body])

Read Pose object from buffer.

unnormalize_distribution(mu, std)

Given mean, standard deviationn unnormalization applied to the pose points distribution.

write(buffer)

Write Pose object to buffer.

Attributes:

pass_through_methods

A set of method names which define actions that can be applied to the pose data.

bbox()[source]

Calculates bounding box for Pose.

Returns:

Pose object representing bounding box (bbox).

Return type:

Pose

focus()[source]

Gets the pose to start at (0,0) and have dimensions as big as needed

frame_dropout_normal(dropout_mean=0.5, dropout_std=0.1)[source]

Normal frame dropout on Pose.

Parameters:
  • dropout_mean (float, optional) – Mean value for dropout. Defaults to 0.5.

  • dropout_std (float, optional) – Standard deviation for dropout. Defaults to 0.1.

Returns:

a tuple with Pose of dropped frames and a list of selected indexes.

Return type:

tuple

frame_dropout_uniform(dropout_min=0.2, dropout_max=1.0)[source]

Perform uniform frame dropout on Pose

Parameters:
  • dropout_min (float, optional) – Minimum dropout value. Defaults to 0.2.

  • dropout_max (float, optional) – Maximum dropout value. Defaults to 1.0.

Returns:

a tuple containing Pose with dropped frames and a list of selected indexes.

Return type:

tuple

get_components(components, points=None)[source]

get pose components based on criteria.

Parameters:
  • components (List[str]) – List of component names to get.

  • points (Dict[str, List[str]], optional) – Mapping of component names to lists of point names to get.

Returns:

Pose object containing new components

Return type:

Pose

normalize(info, scale_factor=1)[source]

Normalize the points to a fixed distance between two particular points.

Parameters:
  • info (PoseNormalizationInfo) – Information for normalization.

  • scale_factor (float, optional) – Scaling factor. Defaults to 1.

Returns:

The normalized Pose object.

Return type:

Pose

normalize_distribution(mu=None, std=None, axis=(0, 1))[source]

Normalize points distribution.

Parameters:
  • mu (np.ndarray, optional) – Mean values for normalization. If None, it will be computed.

  • std (np.ndarray, optional) – Standard deviation values for normalization. If None, it will be computed.

  • axis (tuple of int, optional) – Axes for mean and std computation. Defaults to (0, 1).

Returns:

Calculated mean and standard deviation.

Return type:

tuple of np.ndarray

pass_through_methods = {'augment2d', 'flip', 'interpolate', 'slice_step', 'tensorflow', 'torch'}

A set of method names which define actions that can be applied to the pose data.

Parameters:
  • augment2d (str) – Represents a method to augment 2D points.

  • flip (str) – Represents a method to flip the pose on an axis.

  • interpolate (str) – Represents a method to interpolate missing pose points.

  • torch (str) – Represents a method to convert the body data to torch format.

  • tensorflow (str) – Represents a method to convert the body data to TensorFlow format.

  • slice_step (str) – Represents a method to step through the data.

static read(buffer, pose_body=<class 'pose_format.numpy.pose_body.NumPyPoseBody'>, **kwargs)[source]

Read Pose object from buffer.

Parameters:
  • buffer (bytes) – The input buffer.

  • pose_body (Type[PoseBody], optional) – The type of pose body to be read. Defaults to NumPyPoseBody.

Returns:

Pose object.

Return type:

Pose

unnormalize_distribution(mu, std)[source]

Given mean, standard deviationn unnormalization applied to the pose points distribution.

Parameters:
  • mu (np.ndarray) – The mean values used for normalization.

  • std (np.ndarray) – The standard deviation values used for normalization.

write(buffer)[source]

Write Pose object to buffer.

Parameters:

buffer (BinaryIO) – buffer