# symmetric_keypoints_flip

Python API: `luxonis_ml.data.augmentations.custom.symmetric_keypoints_flip`

## Classes

### HorizontalSymmetricKeypointsFlip

Flip images and symmetric keypoints horizontally.

#### Methods

##### init

```python
def __init__(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` (`float`): Probability of applying the augmentation.

##### apply

```python
def apply(img: np.ndarray, **params) -> np.ndarray:
```

Flip an image horizontally.

Parameters

 * `img` (`np.ndarray`): Image to flip.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Flipped image.

##### apply_to_bboxes

```python
def apply_to_bboxes(bboxes: np.ndarray, **params) -> np.ndarray:
```

Flip bounding boxes horizontally.

Parameters

 * `bboxes` (`np.ndarray`): Bounding boxes to flip.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Flipped bounding boxes.

##### apply_to_keypoints

```python
def apply_to_keypoints(keypoints: np.ndarray, orig_width: int, **params) -> np.ndarray:
```

Flip keypoints horizontally and swap symmetric pairs.

Parameters

 * `keypoints` (`np.ndarray`): Keypoints to flip.
 * `orig_width` (`int`): Original image width.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Flipped keypoints.

Raises

 * `ValueError`: If the total number of keypoints is not a multiple of `n_keypoints`.

##### apply_to_mask

```python
def apply_to_mask(img: np.ndarray, **params) -> np.ndarray:
```

Flip a segmentation mask horizontally.

Parameters

 * `img` (`np.ndarray`): Segmentation mask to flip.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Flipped segmentation mask.

##### get_params_dependent_on_data

```python
def get_params_dependent_on_data(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.

#### Attributes

##### keypoint_pairs

Pairs of keypoint indices swapped after flipping.

##### n_keypoints

Number of unique keypoints described by `keypoint_pairs`.

##### targets

### TransposeSymmetricKeypoints

Transpose images and symmetric keypoints.

#### Methods

##### init

```python
def __init__(keypoint_pairs: list[tuple[int, int]], p: float = 0.5):
```

Transpose an image and symmetric keypoints.

Equivalent to 90 degree rotation followed by horizontal flip.

Parameters

 * `keypoint_pairs` (`list[tuple[int, int]]`): Pairs of keypoint indices to swap after the transpose.
 * `p` (`float`): Probability of applying the augmentation.

##### apply

```python
def apply(img: np.ndarray, **params) -> np.ndarray:
```

Transpose an image.

Parameters

 * `img` (`np.ndarray`): Image to transpose.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Transposed image.

##### apply_to_bboxes

```python
def apply_to_bboxes(bboxes: np.ndarray, **params) -> np.ndarray:
```

Transpose bounding boxes.

Parameters

 * `bboxes` (`np.ndarray`): Bounding boxes to transpose.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Transposed bounding boxes.

##### apply_to_keypoints

```python
def apply_to_keypoints(keypoints: np.ndarray, **params) -> np.ndarray:
```

Transpose keypoints and swap symmetric pairs.

Parameters

 * `keypoints` (`np.ndarray`): Keypoints to transpose.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Transposed keypoints.

Raises

 * `ValueError`: If the total number of keypoints is not a multiple of `n_keypoints`.

##### apply_to_mask

```python
def apply_to_mask(mask: np.ndarray, **params) -> np.ndarray:
```

Transpose a segmentation mask.

Parameters

 * `mask` (`np.ndarray`): Segmentation mask to transpose.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Transposed segmentation mask.

##### get_params_dependent_on_data

```python
def get_params_dependent_on_data(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.

#### Attributes

##### keypoint_pairs

Pairs of keypoint indices swapped after transposition.

##### n_keypoints

Number of unique keypoints described by `keypoint_pairs`.

##### targets

### VerticalSymmetricKeypointsFlip

Flip images and symmetric keypoints vertically.

#### Methods

##### init

```python
def __init__(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` (`float`): Probability of applying the augmentation.

##### apply

```python
def apply(img: np.ndarray, **params) -> np.ndarray:
```

Flip an image vertically.

Parameters

 * `img` (`np.ndarray`): Image to flip.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Flipped image.

##### apply_to_bboxes

```python
def apply_to_bboxes(bboxes: np.ndarray, **params) -> np.ndarray:
```

Flip bounding boxes vertically.

Parameters

 * `bboxes` (`np.ndarray`): Bounding boxes to flip.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Flipped bounding boxes.

##### apply_to_keypoints

```python
def apply_to_keypoints(keypoints: np.ndarray, orig_height: int, **params) -> np.ndarray:
```

Flip keypoints vertically and swap symmetric pairs.

Parameters

 * `keypoints` (`np.ndarray`): Keypoints to flip.
 * `orig_height` (`int`): Original image height.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Flipped keypoints.

Raises

 * `ValueError`: If the total number of keypoints is not a multiple of `n_keypoints`.

##### apply_to_mask

```python
def apply_to_mask(img: np.ndarray, **params) -> np.ndarray:
```

Flip a segmentation mask vertically.

Parameters

 * `img` (`np.ndarray`): Segmentation mask to flip.
 * `**params`: Additional transform parameters.

Returns

 * `np.ndarray`: Flipped segmentation mask.

##### get_params_dependent_on_data

```python
def get_params_dependent_on_data(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.

#### Attributes

##### keypoint_pairs

Pairs of keypoint indices swapped after flipping.

##### n_keypoints

Number of unique keypoints described by `keypoint_pairs`.

##### targets
