pose_format.torch package

PyTorch-specific functionalities.

Subpackages:

Submodules

pose_format.torch.pose_body module

Classes:

TorchPoseBody(fps, data, confidence)

TorchPoseBody class of pose information with PyTorch tensors.

class pose_format.torch.pose_body.TorchPoseBody(fps, data, confidence)[source]

Bases: PoseBody

TorchPoseBody class of pose information with PyTorch tensors.

This class extends the PoseBody class and provides methods for manipulating pose data using PyTorch tensors.

Methods:

cuda()

Move data and cofidence of tensors to GPU

flatten()

Flatten pose data along the associated confidence values.

get_points(indexes)

Get specific points from pose data.

matmul(matrix)

Matrix multiplication on pose data.

points_perspective()

Get pose data with dimensions permuted according to POINTS_DIMS.

zero_filled()

Fill invalid values with zeros.

Attributes:

tensor_reader

Parameters:
  • fps (float) –

  • data (MaskedTensor | Tensor) –

  • confidence (Tensor) –

cuda()[source]

Move data and cofidence of tensors to GPU

flatten()[source]

Flatten pose data along the associated confidence values.

Returns:

Flattened tensor containing indexes, confidence values, and data.

Return type:

torch.Tensor

get_points(indexes)[source]

Get specific points from pose data.

Parameters:

indexes (List[int]) – List of indexes specifying the points that you need.

Returns:

New TorchPoseBody instance containing specified points and associated confidence values.

Return type:

TorchPoseBody

matmul(matrix)[source]

Matrix multiplication on pose data.

Parameters:

matrix (np.ndarray) – matrix to perform multiplication with

Returns:

A new TorchPoseBody instance with results of matrix multiplication.

Return type:

TorchPoseBody

points_perspective()[source]

Get pose data with dimensions permuted according to POINTS_DIMS.

Returns:

A MaskedTensor instance with dimensions permuted for points perspective.

Return type:

MaskedTensor

tensor_reader = 'unpack_torchstr: Reader format for unpacking Torch tensors.'
zero_filled()[source]

Fill invalid values with zeros.

Returns:

TorchPoseBody instance with masked data filled with zeros.

Return type:

TorchPoseBody

pose_format.torch.pose_representation module

Classes:

TorchPoseRepresentation(header[, ...])

TorchPoseRepresentation class representing pose information using PyTorch tensors.

class pose_format.torch.pose_representation.TorchPoseRepresentation(header, rep_modules1=[], rep_modules2=[], rep_modules3=[])[source]

Bases: PoseRepresentation

TorchPoseRepresentation class representing pose information using PyTorch tensors.

This class extends the PoseRepresentation class and provides methods for manipulating and representing pose data using PyTorch tensors.

Parameters:
  • header (PoseHeader) – Header describing the pose data structure.

  • rep_modules1 (List) – List of additional representation modules (level 1) to apply to pose data.

  • rep_modules2 (List) – List of additional representation modules (level 2) to apply to pose data.

  • rep_modules3 (List) – List of additional representation modules (level 3) to apply to pose data.

Methods:

group_embeds(embeds)

Group and reshape embedded tensors for batch processing.

permute(src, shape)

Permute dimensions of tensor according to a specified shape (tuple).

group_embeds(embeds)[source]

Group and reshape embedded tensors for batch processing.

Parameters:

embeds (List[torch.Tensor]) – List of embedded tensors of size (embed_size, Batch, Len).

Returns:

A tensor of size (Batch, Len, embed_size) with grouped and reshaped embedded tensors.

Return type:

torch.Tensor

permute(src, shape)[source]

Permute dimensions of tensor according to a specified shape (tuple).

Parameters:
  • src (torch.Tensor) – tensor to permute

  • shape (tuple) – desired shape of the tensor after permutation.

Returns:

tensor with permuted dimensions according to specified shape.

Return type:

torch.Tensor