cpas_method.py
cpas_toolbox.cpas_method ¶
This module defines the interface for categorical pose and shape estimation methods.
This module defines two classes: PredictionDict and CPASMethod. PredictionDict defines the prediction produced by a CPASMethod. CPASMethod defines the interface used to evaluate categorical pose and shape estimation methods.
PredictionDict ¶
Bases: TypedDict
Pose and shape prediction.
ATTRIBUTE | DESCRIPTION |
---|---|
position |
Position of object center in camera frame. OpenCV convention. Shape (3,).
TYPE:
|
orientation |
Orientation of object in camera frame. OpenCV convention. Scalar-last quaternion, shape (4,).
TYPE:
|
extents |
Bounding box side lengths, shape (3,).
TYPE:
|
reconstructed_pointcloud |
Metrically-scaled reconstructed pointcloud in object frame. None if method does not perform reconstruction.
TYPE:
|
reconstructed_mesh |
Metrically-scaled reconstructed mesh in object frame. None if method does not perform reconstruction.
TYPE:
|
Source code in cpas_toolbox/cpas_method.py
CPASMethod ¶
Bases: ABC
Interface class for categorical pose and shape estimation methods.
Source code in cpas_toolbox/cpas_method.py
__init__ ¶
Initialize categorical pose and shape estimation method.
PARAMETER | DESCRIPTION |
---|---|
config |
Method configuration dictionary.
TYPE:
|
camera |
Camera used for the input image.
TYPE:
|
inference ¶
inference(
color_image: torch.Tensor,
depth_image: torch.Tensor,
instance_mask: torch.Tensor,
category_str: str,
) -> PredictionDict
Run a method to predict pose and shape of an object.
PARAMETER | DESCRIPTION |
---|---|
color_image |
The color image, shape (H, W, 3), RGB, 0-1, float.
TYPE:
|
depth_image |
The depth image, shape (H, W), meters, float.
TYPE:
|
instance_mask |
Mask of object of interest. (H, W), bool.
TYPE:
|
category_str |
The category of the object.
TYPE:
|