<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L1922-L2341) |

Applies the AutoAugment policy to images.

Inherits From: [`ImageAugment`](https://www.tensorflow.org/api_docs/python/tfm/vision/augment/ImageAugment)

    tfm.vision.augment.AutoAugment(
        augmentation_name: str = 'v0',
        policies: Optional[Iterable[Iterable[Tuple[str, float, float]]]] = None,
        cutout_const: float = 100,
        translate_const: float = 250
    )

AutoAugment is from the paper: <https://arxiv.org/abs/1805.09501>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `augmentation_name` | The name of the AutoAugment policy to use. The available options are `v0`, `test`, `reduced_cifar10`, `svhn` and `reduced_imagenet`. `v0` is the policy used for all of the results in the paper and was found to achieve the best results on the COCO dataset. [`v1`](https://www.tensorflow.org/api_docs/python/tf/compat/v1), `v2` and `v3` are additional good policies found on the COCO dataset that have slight variation in what operations were used during the search procedure along with how many operations are applied in parallel to a single image (2 vs 3). Make sure to set `policies` to `None` (the default) if you want to set options using `augmentation_name`. |
| `policies` | list of lists of tuples in the form `(func, prob, level)`, `func` is a string name of the augmentation function, `prob` is the probability of applying the `func` operation, `level` (or magnitude) is the input argument for `func`. For example: <br /> [[('Equalize', 0.9, 3), ('Color', 0.7, 8)], [('Invert', 0.6, 5), ('Rotate', 0.2, 9), ('ShearX', 0.1, 2)], ...] The outer-most list must be 3-d. The number of operations in a sub-policy can vary from one sub-policy to another. If you provide `policies` as input, any option set with `augmentation_name` will get overriden as they are mutually exclusive. |
| `cutout_const` | multiplier for applying cutout. |
| `translate_const` | multiplier for applying translation. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| ValueError if `augmentation_name` is unsupported. ||

<br />

## Methods

### `deit3_three_augment`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2314-L2333)

    @staticmethod
    deit3_three_augment()

Autoaugment policy for three augmentations.

Proposed in paper: <https://arxiv.org/abs/2204.07118>

Each tuple is an augmentation operation of the form
(operation, probability, magnitude). Each element in policy is a
sub-policy that will be applied on the image. Randomly chooses one of the
three augmentation to apply on image.

<br />

<br />

<br />

| Returns ||
|---|---|
| the policy. ||

<br />

### `detection_policy_v0`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2078-L2098)

    @staticmethod
    detection_policy_v0()

Autoaugment policy that was used in AutoAugment Paper for Detection.

<https://arxiv.org/pdf/1906.11172>

Each tuple is an augmentation operation of the form
(operation, probability, magnitude). Each element in policy is a
sub-policy that will be applied sequentially on the image.

<br />

<br />

<br />

| Returns ||
|---|---|
| the policy. ||

<br />

### `distort`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2052-L2062)

    distort(
        image: tf.Tensor
    ) -> tf.Tensor

See base class.

### `distort_with_boxes`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2064-L2076)

    distort_with_boxes(
        image: tf.Tensor, bboxes: tf.Tensor
    ) -> Tuple[tf.Tensor, tf.Tensor]

See base class.

### `panoptic_deeplab_policy`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2288-L2296)

    @staticmethod
    panoptic_deeplab_policy()

### `policy_reduced_cifar10`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2141-L2181)

    @staticmethod
    policy_reduced_cifar10()

Autoaugment policy for reduced CIFAR-10 dataset.

Result is from the AutoAugment paper: <https://arxiv.org/abs/1805.09501>

Each tuple is an augmentation operation of the form
(operation, probability, magnitude). Each element in policy is a
sub-policy that will be applied sequentially on the image.

<br />

<br />

<br />

| Returns ||
|---|---|
| the policy. ||

<br />

### `policy_reduced_imagenet`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2225-L2265)

    @staticmethod
    policy_reduced_imagenet()

Autoaugment policy for reduced ImageNet dataset.

Result is from the AutoAugment paper: <https://arxiv.org/abs/1805.09501>

Each tuple is an augmentation operation of the form
(operation, probability, magnitude). Each element in policy is a
sub-policy that will be applied sequentially on the image.

<br />

<br />

<br />

| Returns ||
|---|---|
| the policy. ||

<br />

### `policy_simple`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2267-L2286)

    @staticmethod
    policy_simple()

Same as `policy_v0`, except with custom ops removed.

### `policy_svhn`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2183-L2223)

    @staticmethod
    policy_svhn()

Autoaugment policy for SVHN dataset.

Result is from the AutoAugment paper: <https://arxiv.org/abs/1805.09501>

Each tuple is an augmentation operation of the form
(operation, probability, magnitude). Each element in policy is a
sub-policy that will be applied sequentially on the image.

<br />

<br />

<br />

| Returns ||
|---|---|
| the policy. ||

<br />

### `policy_test`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2335-L2341)

    @staticmethod
    policy_test()

Autoaugment test policy for debugging.

### `policy_v0`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2100-L2139)

    @staticmethod
    policy_v0()

Autoaugment policy that was used in AutoAugment Paper.

Each tuple is an augmentation operation of the form
(operation, probability, magnitude). Each element in policy is a
sub-policy that will be applied sequentially on the image.

<br />

<br />

<br />

| Returns ||
|---|---|
| the policy. ||

<br />

### `vit`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/augment.py#L2298-L2312)

    @staticmethod
    vit()

Autoaugment policy for a generic ViT.