PSRoIPool

class paddle.vision.ops. PSRoIPool ( output_size, spatial_scale=1.0 ) [source]

This interface is used to construct a callable object of the PSRoIPool class. Please refer to psroi_pool.

Parameters
  • output_size (int|Tuple(int, int)) The pooled output size(H, W) – is int32. If int, H and W are both equal to output_size.

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

Shape:
  • x: 4-D Tensor with shape (N, C, H, W).

  • boxes: 2-D Tensor with shape (num_rois, 4).

  • boxes_num: 1-D Tensor.

  • output: 4-D tensor with shape (num_rois, output_channels, pooled_h, pooled_w).

    The output_channels equal to C / (pooled_h * pooled_w), where C is the channels of input.

Returns

None.

Examples

>>> import paddle

>>> psroi_module = paddle.vision.ops.PSRoIPool(7, 1.0)
>>> x = paddle.uniform([2, 490, 28, 28], dtype='float32')
>>> boxes = paddle.to_tensor([[1, 5, 8, 10], [4, 2, 6, 7], [12, 12, 19, 21]], dtype='float32')
>>> boxes_num = paddle.to_tensor([1, 2], dtype='int32')
>>> pool_out = psroi_module(x, boxes, boxes_num)
>>> print(pool_out.shape)
[3, 10, 7, 7]
forward ( x, boxes, boxes_num )

forward

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments