paddle.fluid.layers.nn. psroi_pool ( input, rois, output_channels, spatial_scale, pooled_height, pooled_width, name=None ) [source]

PSROIPool Operator, rois of this op should be a LoDTensor

Position sensitive region of interest pooling (also known as PSROIPooling) is to perform position-sensitive average pooling on regions of interest specified by input, takes as input N position-sensitive score maps and a list of num_rois regions of interest.

PSROIPooling for R-FCN. Please refer to for more details.

  • input (Variable) – Tensor, the input of PSROIPoolOp. The format of input tensor is NCHW. Where N is the batch size, C is the number of input channels, H is the height of the input feature map, and W is the width. The data type can be float32 or float64

  • rois (Variable) – LoDTensor, ROIs (Regions of Interest) to pool over.It should be a 2-D LoDTensor of shape (num_rois, 4), the lod level is 1. Given as [[x1, y1, x2, y2], …], (x1, y1) is the top left coordinates, and (x2, y2) is the bottom right coordinates. The data type is the same as input

  • output_channels (int) – (int), the number of channels of the output feature map. For a task of C classes of objects, output_channels should be (C + 1) for classification only

  • spatial_scale (float) – (float, default 1.0), Multiplicative spatial scale factor to translate ROI coords from their input scale to the scale used when pooling Default: 1.0

  • pooled_height (int) – (int, default 1), the pooled output height Default: 1

  • pooled_width (int) – (int, default 1), the pooled output width Default: 1

  • name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name


Tensor, the output of PSROIPoolOp is a 4-D Tensor with shape (num_rois, output_channels, pooled_h, pooled_w). The data type is the same as x .

Return Type:



import paddle.fluid as fluid
import paddle
x ='x', shape=[100, 490, 28, 28], dtype='float32')
rois ='rois', shape=[None, 4], lod_level=1, dtype='float32')
pool_out = fluid.layers.psroi_pool(x, rois, 10, 1.0, 7, 7)