<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/preprocess_ops.py#L843-L892) |

Randomly flips input image and bounding boxes horizontally.

    tfm.vision.preprocess_ops.random_horizontal_flip_with_roi(
        image: tf.Tensor,
        boxes: Optional[tf.Tensor] = None,
        masks: Optional[tf.Tensor] = None,
        roi_boxes: Optional[tf.Tensor] = None,
        seed: int = 1
    ) -> Tuple[tf.Tensor, Optional[tf.Tensor], Optional[tf.Tensor], Optional[tf.Tensor]]

Extends preprocess_ops.random_horizontal_flip to also flip roi_boxes used
by ViLD.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `image` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor), the image to apply the random flip. |
| `boxes` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) or `None`, boxes corresponding to the image. |
| `masks` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) or `None`, masks corresponding to the image. |
| `roi_boxes` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) or `None`, RoIs corresponding to the image. |
| `seed` | Seed for Tensorflow's random number generator. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `image` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor), flipped image. |
| `boxes` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) or `None`, flipped boxes corresponding to the image. |
| `masks` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) or `None`, flipped masks corresponding to the image. |
| `roi_boxes` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) or `None`, flipped RoIs corresponding to the image. |

<br />