pocketpose.models.body.efficientpose#

Module Contents#

Classes#

EfficientPose

Base class for EfficientPose models.

EfficientPoseRTLite

EfficientPose-RT Lite model.

EfficientPoseILite

EfficientPose-I Lite model.

EfficientPoseIILite

EfficientPose-II Lite model.

EfficientPoseRT

EfficientPose-RT model.

EfficientPoseI

EfficientPose-I model.

EfficientPoseII

EfficientPose-II model.

EfficientPoseIII

EfficientPose-III model.

EfficientPoseIV

EfficientPose-IV model.

class pocketpose.models.body.efficientpose.EfficientPose(model_path: str, model_url: str, input_size: tuple, real_time: bool = False, lite: bool = False)#

Bases: pocketpose.models.interfaces.TFLiteModel

Base class for EfficientPose models.

process_image(image)#

Default implementation of process_image() for models that don’t need preprocessing.

This method can be overridden by subclasses to implement model-specific preprocessing.

Args:
image (np.ndarray): The image to prepare for prediction. The image is a numpy

array with shape (1, height, width, channels) and dtype uint8 (range [0, 255]).

reorder_keypoints(keypoints: numpy.ndarray) numpy.ndarray#

Sort the keypoints according to match the expected order.

EfficientPose outputs the keypoints in a different order than the expected order, so we need to reorder them. This function takes the predicted keypoints, maps them to the expected order and returns the reordered keypoints.

postprocess_prediction(prediction, original_size)#

Postprocesses the prediction to get the keypoints.

Args:
prediction (Any): The raw prediction returned by the model. This can

be a single tensor or a tuple of tensors, depending on the model.

original_size (tuple): The original size of the input image as (height, width).

Returns:

The predicted keypoints as a list of (x, y, score) tuples.

decode_heatmaps(heatmaps, original_size)#

Decode the heatmaps to keypoints coordinates.

Args:

heatmaps (np.ndarray): Numpy array of shape (1, H, W, K)

Returns:

List of predicted coordinates of shape (K, 3) as (x, y, score)

class pocketpose.models.body.efficientpose.EfficientPoseRTLite#

Bases: EfficientPose

EfficientPose-RT Lite model.

class pocketpose.models.body.efficientpose.EfficientPoseILite#

Bases: EfficientPose

EfficientPose-I Lite model.

class pocketpose.models.body.efficientpose.EfficientPoseIILite#

Bases: EfficientPose

EfficientPose-II Lite model.

class pocketpose.models.body.efficientpose.EfficientPoseRT#

Bases: EfficientPose

EfficientPose-RT model.

class pocketpose.models.body.efficientpose.EfficientPoseI#

Bases: EfficientPose

EfficientPose-I model.

class pocketpose.models.body.efficientpose.EfficientPoseII#

Bases: EfficientPose

EfficientPose-II model.

class pocketpose.models.body.efficientpose.EfficientPoseIII#

Bases: EfficientPose

EfficientPose-III model.

class pocketpose.models.body.efficientpose.EfficientPoseIV#

Bases: EfficientPose

EfficientPose-IV model.