pose_format.pose_representation module

Classes:

PoseRepresentation(header[, rep_modules1, ...])

Represents a pose using various representation modules.

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

Bases: object

Represents a pose using various representation modules.

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

  • rep_modules1 (List, optional) – List of modules that use a point-based representation. Defaults to an empty list.

  • rep_modules2 (List, optional) – List of modules that use a limb-based representation. Defaults to an empty list.

  • rep_modules3 (List, optional) – List of modules that use a triangle-based representation. Defaults to an empty list.

input_size

Combined point count across all components of the header.

Type:

int

rep_modules1_size

The size represented by the point-based modules.

Type:

int

rep_modules2_size

The size represented by the limb-based modules.

Type:

int

rep_modules3_size

The size represented by the triangle-based modules.

Type:

int

output_size

The overall size of the output representation.

Type:

int

Methods:

calc_output_size()

Calculate total size of output representation, based on active modules

get_limbs_points()

Get points that define limbs

get_points(tensor, points)

get points from a given tensor

get_triangles_points()

Get points that make up triangles.

group_embeds(embeds)

Groups given embeddings into a desired format.

permute(src, shape)

Permutes given tensor according to shape.

calc_output_size()[source]

Calculate total size of output representation, based on active modules

Returns:

Total size of the module representation.

Return type:

int

get_limbs_points()[source]

Get points that define limbs

Returns:

Two lists containing points that define the start and end of each limb.

Return type:

Tuple[List, List]

get_points(tensor, points)[source]

get points from a given tensor

Parameters:
  • tensor (torch.Tensor) – Tensor from which you need the points.

  • points (List[int]) – Indices of points that need to be extracted.

Returns:

Gotten points from tensor.

Return type:

torch.Tensor

get_triangles_points()[source]

Get points that make up triangles.

Returns:

Three lists which have points that define each corner of the triangles.

Return type:

Tuple[List, List, List]

group_embeds(embeds)[source]

Groups given embeddings into a desired format. Must be implemented by subclasses.

Parameters:

embeds (List) – List of tensor embeddings, tensor size: (embed_size, Batch, Len).

Raises:

NotImplementedError – If the method is not implemented by subclasses.

Return type:

Size (Batch, Len, embed_size)

permute(src, shape)[source]

Permutes given tensor according to shape.

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

  • shape (tuple) – Desired shape of permuted tensor.

Raises:

NotImplementedError – If method is not implemented by subclasses.