<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/modeling/layers/roi_aligner.py#L23-L74) |

Performs ROIAlign for the second stage processing.

    tfm.vision.layers.MultilevelROIAligner(
        crop_size: int = 7, sample_offset: float = 0.5, **kwargs
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `crop_size` | An `int` of the output size of the cropped features. |
| `sample_offset` | A `float` in \[0, 1\] of the subpixel sample offset. |
| `**kwargs` | Additional keyword arguments passed to Layer. |

<br />

## Methods

### `call`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/modeling/layers/roi_aligner.py#L41-L67)

    call(
        features: Mapping[str, tf.Tensor], boxes: tf.Tensor, training: bool = None
    )

Generates ROIs.

<br />

<br />

<br />

| Args ||
|---|---|
| `features` | A dictionary with key as pyramid level and value as features. The features are in shape of \[batch_size, height_l, width_l, num_filters\]. |
| `boxes` | A 3-D [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of shape \[batch_size, num_boxes, 4\]. Each row represents a box with \[y1, x1, y2, x2\] in un-normalized coordinates. from grid point. |
| `training` | A `bool` of whether it is in training mode. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A 5-D [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) representing feature crop of shape \[batch_size, num_boxes, crop_size, crop_size, num_filters\]. ||

<br />