# symmetric_keypoints_flip

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

## Classes

| Name | Description |
| --- | --- |
|
[`HorizontalSymmetricKeypointsFlip`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip images and symmetric keypoints horizontally. |
|
[`TransposeSymmetricKeypoints`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Transpose images and symmetric keypoints. |
|
[`VerticalSymmetricKeypointsFlip`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip images and symmetric keypoints vertically. |

### class `HorizontalSymmetricKeypointsFlip`

```python
class HorizontalSymmetricKeypointsFlip(A.DualTransform)
```

Flip images and symmetric keypoints horizontally.

Attributes

| Name | Description |
| --- | --- |
| `keypoint_pairs` | Pairs of keypoint indices swapped after flipping. |
| `n_keypoints` | Number of unique keypoints described by `keypoint_pairs`. |

Properties

| Name | Type | Description |
| --- | --- | --- |
|
[`targets`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| `dict[str, Any]` | |

Methods

| Name | Description |
| --- | --- |
|
[`__init__`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip an image and symmetric keypoints horizontally. |
|
[`apply`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip an image horizontally. |
|
[`apply_to_bboxes`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip bounding boxes horizontally. |
|
[`apply_to_keypoints`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip keypoints horizontally and swap symmetric pairs. |
|
[`apply_to_mask`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip a segmentation mask horizontally. |
|
[`get_params_dependent_on_data`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Get parameters dependent on the targets. |

#### property `targets`

```python
targets: dict[str, Any]
```

#### method `__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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `keypoint_pairs` | `list[tuple[int, int]]` | Pairs of keypoint indices to swap after the flip. | required |
| `p` | `float` | Probability of applying the augmentation. | `0.5` |

#### method `apply`

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

Flip an image horizontally.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `img` | `np.ndarray` | Image to flip. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Flipped image. |

#### method `apply_to_bboxes`

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

Flip bounding boxes horizontally.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `bboxes` | `np.ndarray` | Bounding boxes to flip. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Flipped bounding boxes. |

#### method `apply_to_keypoints`

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

Flip keypoints horizontally and swap symmetric pairs.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `keypoints` | `np.ndarray` | Keypoints to flip. | required |
| `orig_width` | `int` | Original image width. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Flipped keypoints. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If the total number of keypoints is not a multiple of `n_keypoints`. |

#### method `apply_to_mask`

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

Flip a segmentation mask horizontally.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `img` | `np.ndarray` | Segmentation mask to flip. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Flipped segmentation mask. |

#### method `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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `params` | `dict[str, Any]` | Existing augmentation parameters. | required |
| `data` | `dict[str, Any]` | Input data. | required |

Returns

| Type | Description |
| --- | --- |
| `dict[str, Any]` | Parameters derived from the input targets. |

### class `TransposeSymmetricKeypoints`

```python
class TransposeSymmetricKeypoints(A.DualTransform)
```

Transpose images and symmetric keypoints.

Attributes

| Name | Description |
| --- | --- |
| `keypoint_pairs` | Pairs of keypoint indices swapped after transposition. |
| `n_keypoints` | Number of unique keypoints described by `keypoint_pairs`. |

Properties

| Name | Type | Description |
| --- | --- | --- |
|
[`targets`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| `dict[str, Any]` | |

Methods

| Name | Description |
| --- | --- |
|
[`__init__`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Transpose an image and symmetric keypoints. |
|
[`apply`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Transpose an image. |
|
[`apply_to_bboxes`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Transpose bounding boxes. |
|
[`apply_to_keypoints`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Transpose keypoints and swap symmetric pairs. |
|
[`apply_to_mask`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Transpose a segmentation mask. |
|
[`get_params_dependent_on_data`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Get parameters dependent on the targets. |

#### property `targets`

```python
targets: dict[str, Any]
```

#### method `__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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `keypoint_pairs` | `list[tuple[int, int]]` | Pairs of keypoint indices to swap after the transpose. | required |
| `p` | `float` | Probability of applying the augmentation. | `0.5` |

#### method `apply`

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

Transpose an image.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `img` | `np.ndarray` | Image to transpose. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Transposed image. |

#### method `apply_to_bboxes`

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

Transpose bounding boxes.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `bboxes` | `np.ndarray` | Bounding boxes to transpose. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Transposed bounding boxes. |

#### method `apply_to_keypoints`

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

Transpose keypoints and swap symmetric pairs.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `keypoints` | `np.ndarray` | Keypoints to transpose. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Transposed keypoints. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If the total number of keypoints is not a multiple of `n_keypoints`. |

#### method `apply_to_mask`

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

Transpose a segmentation mask.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `mask` | `np.ndarray` | Segmentation mask to transpose. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Transposed segmentation mask. |

#### method `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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `params` | `dict[str, Any]` | Existing augmentation parameters. | required |
| `data` | `dict[str, Any]` | Input data. | required |

Returns

| Type | Description |
| --- | --- |
| `dict[str, Any]` | Parameters derived from the input targets. |

### class `VerticalSymmetricKeypointsFlip`

```python
class VerticalSymmetricKeypointsFlip(A.DualTransform)
```

Flip images and symmetric keypoints vertically.

Attributes

| Name | Description |
| --- | --- |
| `keypoint_pairs` | Pairs of keypoint indices swapped after flipping. |
| `n_keypoints` | Number of unique keypoints described by `keypoint_pairs`. |

Properties

| Name | Type | Description |
| --- | --- | --- |
|
[`targets`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| `dict[str, Any]` | |

Methods

| Name | Description |
| --- | --- |
|
[`__init__`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip an image and symmetric keypoints vertically. |
|
[`apply`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip an image vertically. |
|
[`apply_to_bboxes`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip bounding boxes vertically. |
|
[`apply_to_keypoints`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip keypoints vertically and swap symmetric pairs. |
|
[`apply_to_mask`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Flip a segmentation mask vertically. |
|
[`get_params_dependent_on_data`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/augmentations/custom/symmetric_keypoints_flip.md)
| Get parameters dependent on the targets. |

#### property `targets`

```python
targets: dict[str, Any]
```

#### method `__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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `keypoint_pairs` | `list[tuple[int, int]]` | Pairs of keypoint indices to swap after the flip. | required |
| `p` | `float` | Probability of applying the augmentation. | `0.5` |

#### method `apply`

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

Flip an image vertically.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `img` | `np.ndarray` | Image to flip. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Flipped image. |

#### method `apply_to_bboxes`

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

Flip bounding boxes vertically.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `bboxes` | `np.ndarray` | Bounding boxes to flip. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Flipped bounding boxes. |

#### method `apply_to_keypoints`

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

Flip keypoints vertically and swap symmetric pairs.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `keypoints` | `np.ndarray` | Keypoints to flip. | required |
| `orig_height` | `int` | Original image height. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Flipped keypoints. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If the total number of keypoints is not a multiple of `n_keypoints`. |

#### method `apply_to_mask`

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

Flip a segmentation mask vertically.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `img` | `np.ndarray` | Segmentation mask to flip. | required |
| `**params` |  | Additional transform parameters. |  |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | Flipped segmentation mask. |

#### method `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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `params` | `dict[str, Any]` | Existing augmentation parameters. | required |
| `data` | `dict[str, Any]` | Input data. | required |

Returns

| Type | Description |
| --- | --- |
| `dict[str, Any]` | Parameters derived from the input targets. |
