class_docstr: Mask sampling result.
code: def __init__(
      self, pos_inds, neg_inds, masks, gt_masks, assign_result, gt_flags
  ):
      self.pos_inds = pos_inds
      self.neg_inds = neg_inds
      self.pos_masks = masks[pos_inds]
      self.neg_masks = masks[neg_inds]
      self.pos_is_gt = gt_flags[pos_inds]
  
      self.num_gts = gt_masks.shape[0]
      self.pos_assigned_gt_inds = assign_result.gt_inds[pos_inds] - 1
  
      if gt_masks.numel() == 0:
          # hack for index error case
          assert self.pos_assigned_gt_inds.numel() == 0
          self.pos_gt_masks = torch.empty_like(gt_masks)
      else:
          self.pos_gt_masks = gt_masks[self.pos_assigned_gt_inds, :]
  
      if assign_result.labels is not None:
          self.pos_gt_labels = assign_result.labels[pos_inds]
      else:
          self.pos_gt_labels = None
  
file_path: dinov2/dinov2/eval/segmentation_m2f/core/box/samplers/mask_sampling_result.py
imports: import torch
  from .sampling_result import SamplingResult
label_desc: Use image node_id 1 to create a new MaskSamplingResult object from inherited base classes: SamplingResult with example: obj = MaskSamplingResult(pos_inds, neg_inds, masks, gt_masks, assign_result, gt_flags)