class_docstr: Referring Expression Segmentation Metric.
docstr: Process one batch of data and data_samples.
  
  The processed results should be stored in ``self.results``, which will
  be used to compute the metrics when all batches have been processed.
  
  Args:
      data_batch (dict): A batch of data from the dataloader.
      data_samples (Sequence[dict]): A batch of outputs from the model.
docstr_tok: ["Process","one","batch","of","data","and","data_samples",".","The","processed","results","should","be","stored","in","``","self.results","``",",","which","will","be","used","to","compute","the","metrics","when","all","batches","have","been","processed",".","Args",":","data_batch","(","dict",")",":","A","batch","of","data","from","the","dataloader",".","data_samples","(","Sequence","[","dict","]",")",":","A","batch","of","outputs","from","the","model","."]
code: def process(
      self, data_batch: dict, data_samples: Sequence[dict]
  ) -> None:
      """Process one batch of data and data_samples.
  
      The processed results should be stored in ``self.results``, which will
      be used to compute the metrics when all batches have been processed.
  
      Args:
          data_batch (dict): A batch of data from the dataloader.
          data_samples (Sequence[dict]): A batch of outputs from the model.
      """
      for data_sample in data_samples:
          pred_label = data_sample["pred_instances"]["masks"].bool()
          label = (
              data_sample["gt_masks"]
              .to_tensor(pred_label.dtype, pred_label.device)
              .bool()
          )
          # calculate iou
          overlap, union = self.compute_iou(pred_label, label)
  
          bs = len(pred_label)
          iou = (
              overlap.reshape(bs, -1).sum(-1)
              * 1.0
              / union.reshape(bs, -1).sum(-1)
          )
          iou = torch.nan_to_num_(iou, nan=0.0)
          self.results.append(
              (overlap.sum(), union.sum(), iou.sum(), bs)
          )
  
file_path: mmdetection/mmdet/evaluation/metrics/refseg_metric.py
imports: from typing import Sequence
  import torch
  from mmengine.evaluator import BaseMetric
  from mmdet.registry import METRICS
label_desc: Use image node_id 3 for calling the RefSegMetric obj's underlying member method code with example usage: obj.process(data_batch, data_samples) without return types