class_docstr: `PointRend <https://arxiv.org/abs/1912.08193>`_.
class_docstr_tok: ["`","PointRend","<","https",":","\/\/arxiv.org\/abs\/1912.08193",">","`","_","."]
docstr: Run forward function and calculate loss for point head in
  training.
docstr_tok: ["Run","forward","function","and","calculate","loss","for","point","head","in","training","."]
code: def _mask_point_forward_train(
      self, x, sampling_results, mask_pred, gt_masks, img_metas
  ):
      """Run forward function and calculate loss for point head in
      training."""
      pos_labels = torch.cat(
          [res.pos_gt_labels for res in sampling_results]
      )
      rel_roi_points = self.point_head.get_roi_rel_points_train(
          mask_pred, pos_labels, cfg=self.train_cfg
      )
      rois = bbox2roi([res.pos_bboxes for res in sampling_results])
  
      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
      )
      mask_point_target = self.point_head.get_targets(
          rois,
          rel_roi_points,
          sampling_results,
          gt_masks,
          self.train_cfg,
      )
      loss_mask_point = self.point_head.loss(
          mask_point_pred, mask_point_target, pos_labels
      )
  
      return loss_mask_point
  
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 5 for calling the PointRendRoIHead obj's underlying member method code with example usage: obj._mask_point_forward_train(x, sampling_results, mask_pred, gt_masks, img_metas) and returns: loss_mask_point