---
title: RoiAlign
description: "在每个ROI（Region of Interest）区域进行池化处理。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/aolapi/atlasoxol_09_0133.html
sourcePath: /source/zh/canncommercial/900/API/aolapi/atlasoxol_09_0133.html
indexId: bf7b65c6214b3c95dfeeffea4404d03334d181b31ef5ba2d5e4098e7c6162dc663
---
# RoiAlign

#### 功能

在每个ROI（Region of Interest）区域进行池化处理。


#### 输入

- x：输入Tensor，4D输入，数据类型支持float16、float。数据格式为NCHW，shape为(N, C, H, W)
- rois：感兴趣区域。shape=(num_rois, 4)，数据类型支持float16、float。
- batch_indices ：batch对应图像的索引。shape=(num_rois,)，数据类型：int64。


#### 输出

y：输出Tensor，和输入x同样的数据类型，shape=(num_rois, C, output_height, output_width)。


#### 属性

- mode：string，默认为avg，含义：池化方式。
- output_height：int，默认为1，含义：y的高度。
- output_width：int，默认为1，含义：y的宽度。
- sampling_ratio ：int，默认为0，含义：插值算法采样点数。
- spatial_scale：float，默认为1.0，含义：相对于输入图像的空间采样率。
- coordinate_transformation_mode : string，默认为half_pixel，含义：是否对输入值进行偏移（Opset v16及之后版本支持该属性）。


#### 约束

不支持atc工具参数--precision_mode=must_keep_origin_dtype时float64的输入。


#### 支持的ONNX版本

Opset v10/v11/v12/v13/v14/v15/v16/v17/v18
