class_docstr: `PointRend <https://arxiv.org/abs/1912.08193>`_.
class_docstr_tok: ["`","PointRend","<","https",":","\/\/arxiv.org\/abs\/1912.08193",">","`","_","."]
docstr: Mask refining process with point head in testing.
docstr_tok: ["Mask","refining","process","with","point","head","in","testing","."]
code: def _mask_point_forward_test(
      self, x, rois, label_pred, mask_pred, img_metas
  ):
      """Mask refining process with point head in testing."""
      refined_mask_pred = mask_pred.clone()
      for subdivision_step in range(self.test_cfg.subdivision_steps):
          refined_mask_pred = F.interpolate(
              refined_mask_pred,
              scale_factor=self.test_cfg.scale_factor,
              mode="bilinear",
              align_corners=False,
          )
          # If `subdivision_num_points` is larger or equal to the
          # resolution of the next step, then we can skip this step
          (
              num_rois,
              channels,
              mask_height,
              mask_width,
          ) = refined_mask_pred.shape
          if (
              self.test_cfg.subdivision_num_points
              >= self.test_cfg.scale_factor**2
              * mask_height
              * mask_width
              and subdivision_step < self.test_cfg.subdivision_steps - 1
          ):
              continue
          (
              point_indices,
              rel_roi_points,
          ) = self.point_head.get_roi_rel_points_test(
              refined_mask_pred, label_pred, cfg=self.test_cfg
          )
          fine_grained_point_feats = self._get_fine_grained_point_feats(
              x, rois, rel_roi_points, img_metas
          )
          coarse_point_feats = point_sample(mask_pred, rel_roi_points)
          mask_point_pred = self.point_head(
              fine_grained_point_feats, coarse_point_feats
          )
  
          point_indices = point_indices.unsqueeze(1).expand(
              -1, channels, -1
          )
          refined_mask_pred = refined_mask_pred.reshape(
              num_rois, channels, mask_height * mask_width
          )
          refined_mask_pred = refined_mask_pred.scatter_(
              2, point_indices, mask_point_pred
          )
          refined_mask_pred = refined_mask_pred.view(
              num_rois, channels, mask_height, mask_width
          )
  
      return refined_mask_pred
  
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 7 for calling the PointRendRoIHead obj's underlying member method code with example usage: obj._mask_point_forward_test(x, rois, label_pred, mask_pred, img_metas) and returns: refined_mask_pred