class_docstr: Region Proposal Network, introduced by :paper:`Faster R-CNN`.
class_docstr_tok: ["Region","Proposal","Network",",","introduced","by",":","paper",":","`","Faster","R-CNN","`","."]
docstr: Decode all the predicted box regression deltas to proposals. Find the top proposals
  by applying NMS and removing boxes that are too small.
  
  Returns:
      proposals (list[Instances]): list of N Instances. The i-th Instances
          stores post_nms_topk object proposals for image i, sorted by their
          objectness score in descending order.
docstr_tok: ["Decode","all","the","predicted","box","regression","deltas","to","proposals",".","Find","the","top","proposals","by","applying","NMS","and","removing","boxes","that","are","too","small",".","Returns",":","proposals","(","list","[","Instances","]",")",":","list","of","N","Instances",".","The","i-th","Instances","stores","post_nms_topk","object","proposals","for","image","i",",","sorted","by","their","objectness","score","in","descending","order","."]
code: def predict_proposals(
      self,
      anchors: List[Boxes],
      pred_objectness_logits: List[torch.Tensor],
      pred_anchor_deltas: List[torch.Tensor],
      image_sizes: List[Tuple[int, int]],
  ):
      """
      Decode all the predicted box regression deltas to proposals. Find the top proposals
      by applying NMS and removing boxes that are too small.
  
      Returns:
          proposals (list[Instances]): list of N Instances. The i-th Instances
              stores post_nms_topk object proposals for image i, sorted by their
              objectness score in descending order.
      """
      # The proposals are treated as fixed for joint training with roi heads.
      # This approach ignores the derivative w.r.t. the proposal boxes’ coordinates that
      # are also network responses.
      with torch.no_grad():
          pred_proposals = self._decode_proposals(
              anchors, pred_anchor_deltas
          )
          return find_top_rpn_proposals(
              pred_proposals,
              pred_objectness_logits,
              image_sizes,
              self.nms_thresh,
              self.pre_nms_topk[self.training],
              self.post_nms_topk[self.training],
              self.min_box_size,
              self.training,
          )
  
imports: from typing import Dict, List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from torch import nn
  from detectron2.config import configurable
  from detectron2.layers import Conv2d, ShapeSpec, cat
  from detectron2.structures import Boxes, ImageList, Instances, pairwise_iou
  from detectron2.utils.events import get_event_storage
  from detectron2.utils.memory import retry_if_cuda_oom
  from detectron2.utils.registry import Registry
  from ..anchor_generator import build_anchor_generator
  from ..box_regression import Box2BoxTransform, _dense_box_regression_loss
  from ..matcher import Matcher
  from ..sampling import subsample_labels
  from .build import PROPOSAL_GENERATOR_REGISTRY
  from .proposal_utils import find_top_rpn_proposals
label_desc: Use image node_id 7 for calling the RPN obj's underlying member method code with example usage: obj.predict_proposals(anchors, pred_objectness_logits, pred_anchor_deltas, image_sizes) and returns: find_top_rpn_proposals