<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#L2348-L2495) |

Applies the RandAugment policy to images.

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

    tfm.vision.augment.RandAugment(
        num_layers: int = 2,
        magnitude: float = 10.0,
        cutout_const: float = 40.0,
        translate_const: float = 100.0,
        magnitude_std: float = 0.0,
        prob_to_apply: Optional[float] = None,
        exclude_ops: Optional[List[str]] = None
    )

RandAugment is from the paper <https://arxiv.org/abs/1909.13719>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `num_layers` | Integer, the number of augmentation transformations to apply sequentially to an image. Represented as (N) in the paper. Usually best values will be in the range \[1, 3\]. |
| `magnitude` | Integer, shared magnitude across all augmentation operations. Represented as (M) in the paper. Usually best values are in the range \[5, 10\]. |
| `cutout_const` | multiplier for applying cutout. |
| `translate_const` | multiplier for applying translation. |
| `magnitude_std` | randomness of the severity as proposed by the authors of the timm library. |
| `prob_to_apply` | The probability to apply the selected augmentation at each layer. |
| `exclude_ops` | exclude selected operations. |

<br />

## Methods

### `build_for_detection`

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

    @classmethod
    build_for_detection(
        num_layers: int = 2,
        magnitude: float = 10.0,
        cutout_const: float = 40.0,
        translate_const: float = 100.0,
        magnitude_std: float = 0.0,
        prob_to_apply: Optional[float] = None,
        exclude_ops: Optional[List[str]] = None
    )

Builds a RandAugment that modifies bboxes for geometric transforms.

### `distort`

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

    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#L2490-L2495)

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

See base class.