class_docstr: Mixin class for test time augmentation of bboxes.
docstr: Test det bboxes with test time augmentation.
  
  Args:
      feats (list[Tensor]): the outer list indicates test-time
          augmentations and inner Tensor should have a shape NxCxHxW,
          which contains features for all images in the batch.
      img_metas (list[list[dict]]): the outer list indicates test-time
          augs (multiscale, flip, etc.) and the inner list indicates
          images in a batch. each dict has image information.
      rescale (bool, optional): Whether to rescale the results.
          Defaults to False.
  
  Returns:
      list[ndarray]: bbox results of each class
docstr_tok: ["Test","det","bboxes","with","test","time","augmentation",".","Args",":","feats","(","list","[","Tensor","]",")",":","the","outer","list","indicates","test-time","augmentations","and","inner","Tensor","should","have","a","shape","NxCxHxW",",","which","contains","features","for","all","images","in","the","batch",".","img_metas","(","list","[","list","[","dict","]","]",")",":","the","outer","list","indicates","test-time","augs","(","multiscale",",","flip",",","etc",".",")","and","the","inner","list","indicates","images","in","a","batch",".","each","dict","has","image","information",".","rescale","(","bool",",","optional",")",":","Whether","to","rescale","the","results",".","Defaults","to","False",".","Returns",":","list","[","ndarray","]",":","bbox","results","of","each","class"]
code: def aug_test_bboxes(self, feats, img_metas, rescale=False):
      """Test det bboxes with test time augmentation.
  
      Args:
          feats (list[Tensor]): the outer list indicates test-time
              augmentations and inner Tensor should have a shape NxCxHxW,
              which contains features for all images in the batch.
          img_metas (list[list[dict]]): the outer list indicates test-time
              augs (multiscale, flip, etc.) and the inner list indicates
              images in a batch. each dict has image information.
          rescale (bool, optional): Whether to rescale the results.
              Defaults to False.
  
      Returns:
          list[ndarray]: bbox results of each class
      """
      # check with_nms argument
      gb_sig = signature(self.get_bboxes)
      gb_args = [p.name for p in gb_sig.parameters.values()]
      gbs_sig = signature(self._get_bboxes_single)
      gbs_args = [p.name for p in gbs_sig.parameters.values()]
      assert ("with_nms" in gb_args) and ("with_nms" in gbs_args), (
          f"{self.__class__.__name__}"
          " does not support test-time augmentation"
      )
  
      aug_bboxes = []
      aug_scores = []
      aug_factors = []  # score_factors for NMS
      for x, img_meta in zip(feats, img_metas):
          # only one image in the batch
          outs = self.forward(x)
          bbox_inputs = outs + (img_meta, self.test_cfg, False, False)
          bbox_outputs = self.get_bboxes(*bbox_inputs)[0]
          aug_bboxes.append(bbox_outputs[0])
          aug_scores.append(bbox_outputs[1])
          # bbox_outputs of some detectors (e.g., ATSS, FCOS, YOLOv3)
          # contains additional element to adjust scores before NMS
          if len(bbox_outputs) >= 3:
              aug_factors.append(bbox_outputs[2])
  
      # after merging, bboxes will be rescaled to the original image size
      merged_bboxes, merged_scores = self.merge_aug_bboxes(
          aug_bboxes, aug_scores, img_metas
      )
      merged_factors = (
          torch.cat(aug_factors, dim=0) if aug_factors else None
      )
      det_bboxes, det_labels = multiclass_nms(
          merged_bboxes,
          merged_scores,
          self.test_cfg.score_thr,
          self.test_cfg.nms,
          self.test_cfg.max_per_img,
          score_factors=merged_factors,
      )
  
      if rescale:
          _det_bboxes = det_bboxes
      else:
          _det_bboxes = det_bboxes.clone()
          _det_bboxes[:, :4] *= det_bboxes.new_tensor(
              img_metas[0][0]["scale_factor"]
          )
      bbox_results = bbox2result(
          _det_bboxes, det_labels, self.num_classes
      )
      return bbox_results
  
imports: from inspect import signature
  import torch
  from mmdet.core import bbox2result, bbox_mapping_back, multiclass_nms
label_desc: Use image node_id 2 for calling the BBoxTestMixin obj's underlying member method code with example usage: obj.aug_test_bboxes(feats, img_metas, rescale) and returns: bbox_results