<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#L78-L115) |

Normalizes the image to zero mean and unit variance.

    tfm.vision.preprocess_ops.normalize_image(
        image: tf.Tensor,
        offset: Sequence[float] = https://www.tensorflow.org/api_docs/python/tfm/vision/preprocess_ops#MEAN_NORM,
        scale: Sequence[float] = https://www.tensorflow.org/api_docs/python/tfm/vision/preprocess_ops#STDDEV_NORM
    ) -> tf.Tensor

This function normalizes the input image by subtracting the `offset`
and dividing by the `scale`.

**Important Note about Input Types and Normalization:**

- **Integer Images:** If the input `image` is an integer type (e.g., `uint8`),
  the provided `offset` and `scale` values should be already **normalized**
  to the range \[0, 1\]. This is because the function converts integer images to
  float32 with values in the range \[0, 1\] before the normalization happens.

- **Float Images:** If the input `image` is a float type (e.g., `float32`),
  the `offset` and `scale` values should be in the **same range** as the
  image data.

  - If the image has values in \[0, 1\], the `offset` and `scale` should also be in \[0, 1\].
  - If the image has values in \[0, 255\], the `offset` and `scale` should also be in \[0, 255\].

<br />

<br />

<br />

| ## Args ||
|---|---|
| `image` | A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) in either: (1) float dtype with values in range \[0, 1) or \[0, 255\], or (2) int type with values in range \[0, 255\]. |
| `offset` | A tuple of mean values to be subtracted from the image. |
| `scale` | A tuple of normalization factors. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A normalized image tensor. ||

<br />