class documentation

class HorizontalSymmetricKeypointsFlip(A.DualTransform):

Constructor: HorizontalSymmetricKeypointsFlip(keypoint_pairs, p)

View In Hierarchy

Flip images and symmetric keypoints horizontally.

Method __init__ Flip an image and symmetric keypoints horizontally.
Method apply Flip an image horizontally.
Method apply_to_bboxes Flip bounding boxes horizontally.
Method apply_to_keypoints Flip keypoints horizontally and swap symmetric pairs.
Method apply_to_mask Flip a segmentation mask horizontally.
Method get_params_dependent_on_data Get parameters dependent on the targets.
Instance Variable keypoint_pairs Pairs of keypoint indices swapped after flipping.
Instance Variable n_keypoints Number of unique keypoints described by keypoint_pairs.
Property targets Undocumented
def __init__(self, keypoint_pairs: list[tuple[int, int]], p: float = 0.5):

Flip an image and symmetric keypoints horizontally.

Bounding boxes and segmentation masks are flipped as well.

Parameters
keypoint_pairs:list[tuple[int, int]]Pairs of keypoint indices to swap after the flip.
p:floatProbability of applying the augmentation.
@override
def apply(self, img: np.ndarray, **params) -> np.ndarray:

Flip an image horizontally.

Parameters
img:np.ndarrayImage to flip.
**paramsAdditional transform parameters.
Returns
np.ndarrayFlipped image.
@override
def apply_to_bboxes(self, bboxes: np.ndarray, **params) -> np.ndarray:

Flip bounding boxes horizontally.

Parameters
bboxes:np.ndarrayBounding boxes to flip.
**paramsAdditional transform parameters.
Returns
np.ndarrayFlipped bounding boxes.
@override
def apply_to_keypoints(self, keypoints: np.ndarray, orig_width: int, **params) -> np.ndarray:

Flip keypoints horizontally and swap symmetric pairs.

Parameters
keypoints:np.ndarrayKeypoints to flip.
orig_width:intOriginal image width.
**paramsAdditional transform parameters.
Returns
np.ndarrayFlipped keypoints.
Raises
ValueErrorIf the total number of keypoints is not a multiple of n_keypoints.
@override
def apply_to_mask(self, img: np.ndarray, **params) -> np.ndarray:

Flip a segmentation mask horizontally.

Parameters
img:np.ndarraySegmentation mask to flip.
**paramsAdditional transform parameters.
Returns
np.ndarrayFlipped segmentation mask.
@override
def get_params_dependent_on_data(self, params: dict[str, Any], data: dict[str, Any]) -> dict[str, Any]:

Get parameters dependent on the targets.

Parameters
params:dict[str, Any]Existing augmentation parameters.
data:dict[str, Any]Input data.
Returns
dict[str, Any]Parameters derived from the input targets.
keypoint_pairs =

Pairs of keypoint indices swapped after flipping.

n_keypoints =

Number of unique keypoints described by keypoint_pairs.

@property
@override
targets: dict[str, Any] =

Undocumented