Skip to content

Pose

Built-in pipelines for preprocessing, agumentating and predicting.

[source]

EstimatePoseKeypoints

paz.pipelines.pose.EstimatePoseKeypoints(detect, estimate_keypoints, camera, offsets, model_points, class_to_dimensions, radius=3, thickness=1)

[source]

HeadPoseKeypointNet2D32

paz.pipelines.pose.HeadPoseKeypointNet2D32(camera, offsets=[0, 0], radius=5, thickness=2)

Head pose estimation pipeline using a HaarCascade face detector and a pre-trained KeypointNet2D estimation model.

Arguments

  • camera: Instance of paz.backend.camera.Camera with camera intrinsics.
  • offsets: List of floats indicating the scaled offset to be added to the Box2D coordinates.
  • radius: Int. radius of keypoint to be drawn.

Example

from paz.pipelines import HeadPoseKeypointNet2D32

estimate_pose = HeadPoseKeypointNet2D32()

# apply directly to an image (numpy-array)
inferences = estimate_pose(image)

Returns

A function that takes an RGB image and outputs the following inferences as keys of a dictionary: image, boxes2D, keypoints and poses6D.


[source]

SingleInstancePIX2POSE6D

paz.pipelines.pose.SingleInstancePIX2POSE6D(model, object_sizes, camera, epsilon=0.15, resize=False, class_name=None, draw=True)

Predicts a single pose6D from an image. Optionally if a box2D message is given it translates the predicted points2D to new origin located at box2D top-left corner.

Arguments

  • model: Keras segmentation model.
  • object_sizes: Array (3) determining the (width, height, depth)
  • camera: PAZ Camera with intrinsic matrix.
  • epsilon: Float. Values below this value would be replaced by 0.
  • resize: Boolean. If True RGB mask is resized before computing PnP.
  • class_name: Str indicating object name.
  • draw: Boolean. If True drawing functions are applied to output image.

Returns

Dictionary with inferred points2D, points3D, pose6D and image.


[source]

MultiInstancePIX2POSE6D

paz.pipelines.pose.MultiInstancePIX2POSE6D(estimate_pose, offsets, camera=None, draw=True)

Predicts poses6D of multiple instances the same object from an image.

Arguments

  • estimate_pose: Function that takes as input an image and outputs a dictionary with points2D, points3D and pose6D messages e.g SingleInstancePIX2POSE6D
  • offsets: List of length two containing floats e.g. (x_scale, y_scale)
  • camera: PAZ Camera with intrinsic matrix.
  • draw: Boolean. If True drawing functions are applied to output image.

Returns

Dictionary with inferred boxes2D, poses6D and image.


[source]

MultiInstanceMultiClassPIX2POSE6D

paz.pipelines.pose.MultiInstanceMultiClassPIX2POSE6D(detect, name_to_model, name_to_size, camera, offsets, epsilon=0.15, resize=False, draw=True)

Predicts poses6D of multiple instances of multiple objects from an image

Arguments

  • detect: Function that takes as input an image and outputs a dictionary containing Boxes2D messages.
  • name_to_model: Dictionary with class name as key and as value a Keras segmentation model.
  • name_to_size: Dictionary with class name as key and as value the object sizes.
  • camera: PAZ Camera with intrinsic matrix.
  • offsets: List of length two containing floats e.g. (x_scale, y_scale)
  • epsilon: Float. Values below this value would be replaced by 0.
  • resize: Boolean. If True RGB mask is resized before computing PnP.
  • draw: Boolean. If True drawing functions are applied to output image.

Returns

Dictionary with inferred boxes2D, poses6D and image.