# distribute_fpn_proposals¶

paddle.fluid.layers.detection. distribute_fpn_proposals ( fpn_rois, min_level, max_level, refer_level, refer_scale, rois_num=None, name=None ) [source]

This op only takes LoDTensor as input. In Feature Pyramid Networks (FPN) models, it is needed to distribute all proposals into different FPN level, with respect to scale of the proposals, the referring scale and the referring level. Besides, to restore the order of proposals, we return an array which indicates the original index of rois in current proposals. To compute FPN level for each roi, the formula is given as follows:

\begin{align}\begin{aligned}roi\_scale &= \sqrt{BBoxArea(fpn\_roi)}\\\begin{split}level = floor(&\log(\\frac{roi\_scale}{refer\_scale}) + refer\_level)\end{split}\end{aligned}\end{align}

where BBoxArea is a function to compute the area of each roi.

Parameters
• fpn_rois (Variable) – 2-D Tensor with shape [N, 4] and data type is float32 or float64. The input fpn_rois.

• min_level (int32) – The lowest level of FPN layer where the proposals come from.

• max_level (int32) – The highest level of FPN layer where the proposals come from.

• refer_level (int32) – The referring level of FPN layer with specified scale.

• refer_scale (int32) – The referring scale of FPN layer with specified level.

• rois_num (Tensor) – 1-D Tensor contains the number of RoIs in each image. The shape is [B] and data type is int32. B is the number of images. If it is not None then return a list of 1-D Tensor. Each element is the output RoIs’ number of each image on the corresponding level and the shape is [B]. None by default.

• name (str, optional) – For detailed information, please refer to Name. Usually name is no need to set and None by default.

Returns

multi_rois(List) : A list of 2-D LoDTensor with shape [M, 4] and data type of float32 and float64. The length is max_level-min_level+1. The proposals in each FPN level.

restore_ind(Variable): A 2-D Tensor with shape [N, 1], N is the number of total rois. The data type is int32. It is used to restore the order of fpn_rois.

rois_num_per_level(List): A list of 1-D Tensor and each Tensor is the RoIs’ number in each image on the corresponding level. The shape is [B] and data type of int32. B is the number of images

Return type

Tuple

Examples

import paddle.fluid as fluid