class documentation

class VerticalSymmetricKeypointsFlip(A.DualTransform):

Constructor: VerticalSymmetricKeypointsFlip(keypoint_pairs, p)

View In Hierarchy

Flip images and symmetric keypoints vertically.

Method __init__ Flip an image and symmetric keypoints vertically.
Method apply Flip an image vertically.
Method apply_to_bboxes Flip bounding boxes vertically.
Method apply_to_keypoints Flip keypoints vertically and swap symmetric pairs.
Method apply_to_mask Flip a segmentation mask vertically.
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 vertically.

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 vertically.

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 vertically.

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_height: int, **params) -> np.ndarray:

Flip keypoints vertically and swap symmetric pairs.

Parameters
keypoints:np.ndarrayKeypoints to flip.
orig_height:intOriginal image height.
**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 vertically.

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