class_docstr: `PointRend <https://arxiv.org/abs/1912.08193>`_.
class_docstr_tok: ["`","PointRend","<","https",":","\/\/arxiv.org\/abs\/1912.08193",">","`","_","."]
docstr: Test for mask head with test time augmentation.
docstr_tok: ["Test","for","mask","head","with","test","time","augmentation","."]
code: def aug_test_mask(self, feats, img_metas, det_bboxes, det_labels):
      """Test for mask head with test time augmentation."""
      if det_bboxes.shape[0] == 0:
          segm_result = [[] for _ in range(self.mask_head.num_classes)]
      else:
          aug_masks = []
          for x, img_meta in zip(feats, img_metas):
              img_shape = img_meta[0]["img_shape"]
              scale_factor = img_meta[0]["scale_factor"]
              flip = img_meta[0]["flip"]
              _bboxes = bbox_mapping(
                  det_bboxes[:, :4], img_shape, scale_factor, flip
              )
              mask_rois = bbox2roi([_bboxes])
              mask_results = self._mask_forward(x, mask_rois)
              mask_results["mask_pred"] = self._mask_point_forward_test(
                  x,
                  mask_rois,
                  det_labels,
                  mask_results["mask_pred"],
                  img_metas,
              )
              # convert to numpy array to save memory
              aug_masks.append(
                  mask_results["mask_pred"].sigmoid().cpu().numpy()
              )
          merged_masks = merge_aug_masks(
              aug_masks, img_metas, self.test_cfg
          )
  
          ori_shape = img_metas[0][0]["ori_shape"]
          segm_result = self.mask_head.get_seg_masks(
              merged_masks,
              det_bboxes,
              det_labels,
              self.test_cfg,
              ori_shape,
              scale_factor=1.0,
              rescale=False,
          )
      return segm_result
  
file_path: insightface/detection/scrfd/mmdet/models/roi_heads/point_rend_roi_head.py
imports: import torch
  import torch.nn.functional
  from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point
  from mmdet.core import bbox2roi, bbox_mapping, merge_aug_masks
  from ..None import builder
  from ..builder import HEADS
  from .standard_roi_head import StandardRoIHead
label_desc: Use image node_id 9 for calling the PointRendRoIHead obj's underlying member method code with example usage: obj.aug_test_mask(feats, img_metas, det_bboxes, det_labels) and returns: segm_result