class_docstr: Mixin class for testing det bboxes via DenseHead.
class_docstr_tok: ["Mixin","class","for","testing","det","bboxes","via","DenseHead","."]
docstr: Test with augmentation for only for ``RPNHead`` and its variants,
  e.g., ``GARPNHead``, etc.
  
  Args:
      feats (tuple[Tensor]): Features from the upstream network, each is
                  a 4D-tensor.
      img_metas (list[dict]): Meta info of each image.
  
  Returns:
      list[Tensor]: Proposals of each image, each item has shape (n, 5),
          where 5 represent (tl_x, tl_y, br_x, br_y, score).
docstr_tok: ["Test","with","augmentation","for","only","for","``","RPNHead","``","and","its","variants",",","e.g.",",","``","GARPNHead","``",",","etc",".","Args",":","feats","(","tuple","[","Tensor","]",")",":","Features","from","the","upstream","network",",","each","is","a","4D-tensor",".","img_metas","(","list","[","dict","]",")",":","Meta","info","of","each","image",".","Returns",":","list","[","Tensor","]",":","Proposals","of","each","image",",","each","item","has","shape","(","n",",","5",")",",","where","5","represent","(","tl_x",",","tl_y",",","br_x",",","br_y",",","score",")","."]
code: def aug_test_rpn(self, feats, img_metas):
      """Test with augmentation for only for ``RPNHead`` and its variants,
      e.g., ``GARPNHead``, etc.
  
      Args:
          feats (tuple[Tensor]): Features from the upstream network, each is
                      a 4D-tensor.
          img_metas (list[dict]): Meta info of each image.
  
      Returns:
          list[Tensor]: Proposals of each image, each item has shape (n, 5),
              where 5 represent (tl_x, tl_y, br_x, br_y, score).
      """
      samples_per_gpu = len(img_metas[0])
      aug_proposals = [[] for _ in range(samples_per_gpu)]
      for x, img_meta in zip(feats, img_metas):
          results_list = self.simple_test_rpn(x, img_meta)
          for i, results in enumerate(results_list):
              proposals = torch.cat(
                  [results.bboxes, results.scores[:, None]], dim=-1
              )
              aug_proposals[i].append(proposals)
      # reorganize the order of 'img_metas' to match the dimensions
      # of 'aug_proposals'
      aug_img_metas = []
      for i in range(samples_per_gpu):
          aug_img_meta = []
          for j in range(len(img_metas)):
              aug_img_meta.append(img_metas[j][i])
          aug_img_metas.append(aug_img_meta)
      # after merging, proposals will be rescaled to the original image size
  
      merged_proposals = []
      for proposals, aug_img_meta in zip(aug_proposals, aug_img_metas):
          merged_proposal = merge_aug_proposals(
              proposals, aug_img_meta, self.test_cfg
          )
          results = InstanceData()
          results.bboxes = merged_proposal[:, :4]
          results.scores = merged_proposal[:, 4]
          merged_proposals.append(results)
      return merged_proposals
  
file_path: mmdetection/mmdet/models/dense_heads/dense_test_mixins.py
imports: import sys
  import warnings
  from inspect import signature
  import torch
  from mmcv.ops import batched_nms
  from mmengine.structures import InstanceData
  from mmdet.structures.bbox import bbox_mapping_back
  from ..test_time_augs import merge_aug_proposals
label_desc: Use image node_id 3 for calling the BBoxTestMixin obj's underlying member method code with example usage: obj.aug_test_rpn(feats, img_metas) and returns: merged_proposals