docstr: Op for generating RPN porposals.
  
  blobs_in:
    - 'rpn_cls_probs': 4D tensor of shape (N, A, H, W), where N is the
      number of minibatch images, A is the number of anchors per
      locations, and (H, W) is the spatial size of the prediction grid.
      Each value represents a "probability of object" rating in [0, 1].
    - 'rpn_bbox_pred': 4D tensor of shape (N, 4 * A, H, W) of predicted
      deltas for transformation anchor boxes into RPN proposals.
    - 'im_info': 2D tensor of shape (N, 3) where the three columns encode
      the input image's [height, width, scale]. Height and width are
      for the input to the network, not the original image; scale is the
      scale factor used to scale the original image to the network input
      size.
  
  blobs_out:
    - 'rpn_rois': 2D tensor of shape (R, 5), for R RPN proposals where the
      five columns encode [batch ind, x1, y1, x2, y2]. The boxes are
      w.r.t. the network input, which is a *scaled* version of the
      original image; these proposals must be scaled by 1 / scale (where
      scale comes from im_info; see above) to transform it back to the
      original input image coordinate system.
    - 'rpn_roi_probs': 1D tensor of objectness probability scores
      (extracted from rpn_cls_probs; see above).
docstr_tok: ["Op","for","generating","RPN","porposals",".","blobs_in",":","-","'rpn_cls_probs","'",":","4D","tensor","of","shape","(","N",",","A",",","H",",","W",")",",","where","N","is","the","number","of","minibatch","images",",","A","is","the","number","of","anchors","per","locations",",","and","(","H",",","W",")","is","the","spatial","size","of","the","prediction","grid",".","Each","value","represents","a","``","probability","of","object","''","rating","in","[","0",",","1","]",".","-","'rpn_bbox_pred","'",":","4D","tensor","of","shape","(","N",",","4","*","A",",","H",",","W",")","of","predicted","deltas","for","transformation","anchor","boxes","into","RPN","proposals",".","-","'im_info","'",":","2D","tensor","of","shape","(","N",",","3",")","where","the","three","columns","encode","the","input","image","'s","[","height",",","width",",","scale","]",".","Height","and","width","are","for","the","input","to","the","network",",","not","the","original","image",";","scale","is","the","scale","factor","used","to","scale","the","original","image","to","the","network","input","size",".","blobs_out",":","-","'rpn_rois","'",":","2D","tensor","of","shape","(","R",",","5",")",",","for","R","RPN","proposals","where","the","five","columns","encode","[","batch","ind",",","x1",",","y1",",","x2",",","y2","]",".","The","boxes","are","w.r.t",".","the","network","input",",","which","is","a","*","scaled","*","version","of","the","original","image",";","these","proposals","must","be","scaled","by","1","\/","scale","(","where","scale","comes","from","im_info",";","see","above",")","to","transform","it","back","to","the","original","input","image","coordinate","system",".","-","'rpn_roi_probs","'",":","1D","tensor","of","objectness","probability","scores","(","extracted","from","rpn_cls_probs",";","see","above",")","."]
code: def GenerateProposals(
      self, blobs_in, blobs_out, anchors, spatial_scale
  ):
      """Op for generating RPN porposals.
  
      blobs_in:
        - 'rpn_cls_probs': 4D tensor of shape (N, A, H, W), where N is the
          number of minibatch images, A is the number of anchors per
          locations, and (H, W) is the spatial size of the prediction grid.
          Each value represents a "probability of object" rating in [0, 1].
        - 'rpn_bbox_pred': 4D tensor of shape (N, 4 * A, H, W) of predicted
          deltas for transformation anchor boxes into RPN proposals.
        - 'im_info': 2D tensor of shape (N, 3) where the three columns encode
          the input image's [height, width, scale]. Height and width are
          for the input to the network, not the original image; scale is the
          scale factor used to scale the original image to the network input
          size.
  
      blobs_out:
        - 'rpn_rois': 2D tensor of shape (R, 5), for R RPN proposals where the
          five columns encode [batch ind, x1, y1, x2, y2]. The boxes are
          w.r.t. the network input, which is a *scaled* version of the
          original image; these proposals must be scaled by 1 / scale (where
          scale comes from im_info; see above) to transform it back to the
          original input image coordinate system.
        - 'rpn_roi_probs': 1D tensor of objectness probability scores
          (extracted from rpn_cls_probs; see above).
      """
      name = "GenerateProposalsOp:" + ",".join(
          [str(b) for b in blobs_in]
      )
      # spatial_scale passed to the Python op is only used in convert_pkl_to_pb
      self.net.Python(
          GenerateProposalsOp(
              anchors, spatial_scale, self.train
          ).forward
      )(blobs_in, blobs_out, name=name, spatial_scale=spatial_scale)
      return blobs_out
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import numpy
  import logging
  from caffe2.python import cnn
  from caffe2.python import core
  from caffe2.python import workspace
  from caffe2.python.modeling import initializers
  from caffe2.python.modeling.parameter_info import ParameterTags
  from detectron.core.config import cfg
  from detectron.ops.collect_and_distribute_fpn_rpn_proposals import CollectAndDistributeFpnRpnProposalsOp
  from detectron.ops.generate_proposal_labels import GenerateProposalLabelsOp
  from detectron.ops.generate_proposals import GenerateProposalsOp
  import detectron.roi_data.fast_rcnn
  import detectron.utils.c2
label_desc: Use image node_id 4 for calling the DetectionModelHelper obj's underlying member method code with example usage: obj.GenerateProposals(blobs_in, blobs_out, anchors, spatial_scale) and returns: blobs_out