pose_format.tensorflow.pose_body module

Classes:

TensorflowPoseBody(fps, data, confidence)

Representation of pose body data, optimized for TensorFlow operations.

class pose_format.tensorflow.pose_body.TensorflowPoseBody(fps, data, confidence)[source]

Bases: PoseBody

Representation of pose body data, optimized for TensorFlow operations.

  • Inherites from PoseBody

Parameters:
  • fps (float) – The frames per second for the pose data.

  • data (Union[MaskedTensor, tf.Tensor]) – The pose data.

  • confidence (tf.Tensor) – The confidence scores for the pose data.

Methods:

as_tfrecord()

Converts into TensorFlow (tf) record format

frame_dropout_given_percent(dropout_percent)

Remove some frames from the data at random from pose data.

frame_dropout_normal([dropout_mean, dropout_std])

Given mean and standard deviation, randomly drops out based on normal distribution.

frame_dropout_uniform([dropout_min, dropout_max])

Drops randomly frames based on a given uniform distribution

from_tfrecord(tfrecord_dict)

From a TensorFlow record dictionary, it creates a instance of TensorflowPoseBody

get_points(indexes)

Gets and returns points from pose data based on indexes

matmul(matrix)

Multiplies pose data with a given matrix.

points_perspective()

Returns perspective transformation of pose points.

select_frames(frame_indexes)

Selects and returns a subset of frames based on the frame indexes.

zero_filled()

Return an instance with zero-filled data.

Attributes:

tensor_reader

as_tfrecord()[source]

Converts into TensorFlow (tf) record format

Returns:

dictionary representation of TensorFlow (tf) record for the pose body

Return type:

dict

frame_dropout_given_percent(dropout_percent)[source]

Remove some frames from the data at random from pose data.

Parameters:

dropout_percent (float) – The percentage of frames to drop.

Returns:

A new instance with dropped frames and the selected frame indexes.

Return type:

TensorflowPoseBody, tf.Tensor

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

Given mean and standard deviation, randomly drops out based on normal distribution.

Parameters:
  • dropout_mean (float, optional) – The mean for the normal distribution, by default 0.5.

  • dropout_std (float, optional) – The standard deviation for the normal distribution, by default 0.1.

Returns:

instance with frames dropped based on normal distribution.

Return type:

TensorflowPoseBody

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

Drops randomly frames based on a given uniform distribution

Parameters:
  • dropout_min (float, optional) – minimum percentage for dropout, by default 0.2.

  • dropout_max (float, optional) – maximum percentage for dropout, by default 1.0.

Returns:

Instance with frames dropped based on a uniform distribution.

Return type:

TensorflowPoseBody

classmethod from_tfrecord(tfrecord_dict)[source]

From a TensorFlow record dictionary, it creates a instance of TensorflowPoseBody

Parameters:

tfrecord_dict (dict) – Dictionary representation of TensorFlow (tf) record data.

Returns:

An instance constructed from given TensorFlow record data

Return type:

TensorflowPoseBody

get_points(indexes)[source]

Gets and returns points from pose data based on indexes

Parameters:

indexes (List[int]) – List of point indexes to get.

Returns:

Instance containing only the gotten points.

Return type:

TensorflowPoseBody

matmul(matrix)[source]

Multiplies pose data with a given matrix.

Parameters:

matrix (np.ndarray) – Matrix to multiply with pose data.

Returns:

Instance with the pose data multiplied by the matrix.

Return type:

TensorflowPoseBody

points_perspective()[source]

Returns perspective transformation of pose points.

Returns:

Transformed pose data.

Return type:

MaskedTensor

select_frames(frame_indexes)[source]

Selects and returns a subset of frames based on the frame indexes.

Parameters:

frame_indexes (List[int]) – List of frame indexes

Returns:

Instance with the selected frames

Return type:

TensorflowPoseBody

tensor_reader = 'unpack_tensorflowstr: The method used to read the tensor data. (Type: str)'
zero_filled()[source]

Return an instance with zero-filled data.