collect_fpn_proposals

paddle.fluid.layers.collect_fpn_proposals(multi_rois, multi_scores, min_level, max_level, post_nms_top_n, name=None)[source]

This OP only supports LoDTensor as input. Concat multi-level RoIs (Region of Interest) and select N RoIs with respect to multi_scores. This operation performs the following steps:

  1. Choose num_level RoIs and scores as input: num_level = max_level - min_level

  2. Concat multi-level RoIs and scores

  3. Sort scores and select post_nms_top_n scores

  4. Gather RoIs by selected indices from scores

  5. Re-sort RoIs by corresponding batch_id

Parameters
  • multi_rois (list) – List of RoIs to collect. Element in list is 2-D LoDTensor with shape [N, 4] and data type is float32 or float64, N is the number of RoIs.

  • multi_scores (list) – List of scores of RoIs to collect. Element in list is 2-D LoDTensor with shape [N, 1] and data type is float32 or float64, N is the number of RoIs.

  • min_level (int) – The lowest level of FPN layer to collect

  • max_level (int) – The highest level of FPN layer to collect

  • post_nms_top_n (int) – The number of selected RoIs

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

Returns

fpn_rois(Variable): 2-D LoDTensor with shape [N, 4] and data type is float32 or float64. Selected RoIs.

Return type

Variable

Examples

import paddle.fluid as fluid
multi_rois = []
multi_scores = []
for i in range(4):
    multi_rois.append(fluid.data(
        name='roi_'+str(i), shape=[None, 4], dtype='float32', lod_level=1))
for i in range(4):
    multi_scores.append(fluid.data(
        name='score_'+str(i), shape=[None, 1], dtype='float32', lod_level=1))

fpn_rois = fluid.layers.collect_fpn_proposals(
    multi_rois=multi_rois,
    multi_scores=multi_scores,
    min_level=2,
    max_level=5,
    post_nms_top_n=2000)