code: def collect(inputs, is_training):
      cfg_key = "TRAIN" if is_training else "TEST"
      post_nms_topN = cfg[cfg_key].RPN_POST_NMS_TOP_N
      k_max = cfg.FPN.RPN_MAX_LEVEL
      k_min = cfg.FPN.RPN_MIN_LEVEL
      num_lvls = k_max - k_min + 1
      roi_inputs = inputs[:num_lvls]
      score_inputs = inputs[num_lvls:]
      if is_training:
          score_inputs = score_inputs[:-2]
  
      # rois are in [[batch_idx, x0, y0, x1, y2], ...] format
      # Combine predictions across all levels and retain the top scoring
      rois = np.concatenate([blob.data for blob in roi_inputs])
      scores = np.concatenate(
          [blob.data for blob in score_inputs]
      ).squeeze()
      inds = np.argsort(-scores)[:post_nms_topN]
      rois = rois[inds, :]
      return rois
  
file_path: dense-pose/detectron/ops/collect_and_distribute_fpn_rpn_proposals.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import numpy
  from detectron.core.config import cfg
  from detectron.datasets import json_dataset
  from detectron.datasets import roidb
  import detectron.modeling.FPN
  import detectron.roi_data.fast_rcnn
  import detectron.utils.blob
label_desc: Use image node_id 1 for calling a global function with example usage: collect(inputs, is_training) and returns: rois