:py:mod:`pocketpose.models.body.efficientpose`
==============================================

.. py:module:: pocketpose.models.body.efficientpose


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   pocketpose.models.body.efficientpose.EfficientPose
   pocketpose.models.body.efficientpose.EfficientPoseRTLite
   pocketpose.models.body.efficientpose.EfficientPoseILite
   pocketpose.models.body.efficientpose.EfficientPoseIILite
   pocketpose.models.body.efficientpose.EfficientPoseRT
   pocketpose.models.body.efficientpose.EfficientPoseI
   pocketpose.models.body.efficientpose.EfficientPoseII
   pocketpose.models.body.efficientpose.EfficientPoseIII
   pocketpose.models.body.efficientpose.EfficientPoseIV




.. py:class:: EfficientPose(model_path: str, model_url: str, input_size: tuple, real_time: bool = False, lite: bool = False)


   Bases: :py:obj:`pocketpose.models.interfaces.TFLiteModel`

   Base class for EfficientPose models. 

   .. py:method:: 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]). 


   .. py:method:: 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.


   .. py:method:: 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.


   .. py:method:: 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)



.. py:class:: EfficientPoseRTLite


   Bases: :py:obj:`EfficientPose`

   EfficientPose-RT Lite model. 


.. py:class:: EfficientPoseILite


   Bases: :py:obj:`EfficientPose`

   EfficientPose-I Lite model. 


.. py:class:: EfficientPoseIILite


   Bases: :py:obj:`EfficientPose`

   EfficientPose-II Lite model. 


.. py:class:: EfficientPoseRT


   Bases: :py:obj:`EfficientPose`

   EfficientPose-RT model. 


.. py:class:: EfficientPoseI


   Bases: :py:obj:`EfficientPose`

   EfficientPose-I model. 


.. py:class:: EfficientPoseII


   Bases: :py:obj:`EfficientPose`

   EfficientPose-II model. 


.. py:class:: EfficientPoseIII


   Bases: :py:obj:`EfficientPose`

   EfficientPose-III model. 


.. py:class:: EfficientPoseIV


   Bases: :py:obj:`EfficientPose`

   EfficientPose-IV model. 


