class_docstr: Point metric for textspotting. Proposed in SPTS.
  
  Args:
      text_score_thrs (dict): Best text score threshold searching
          space. Defaults to dict(start=0.8, stop=1, step=0.01).
      word_spotting (bool): Whether to work in word spotting mode. Defaults
          to False.
      lexicon_path (str, optional): Lexicon path for word spotting, which
          points to a lexicon file or a directory. Defaults to None.
      lexicon_mapping (tuple, optional): The rule to map test image name to
          its corresponding lexicon file. Only effective when lexicon path
          is a directory. Defaults to ('(.*).jpg', r'.txt').
      pair_path (str, optional): Pair path for word spotting, which points
          to a pair file or a directory. Defaults to None.
      pair_mapping (tuple, optional): The rule to map test image name to
          its corresponding pair file. Only effective when pair path is a
          directory. Defaults to ('(.*).jpg', r'.txt').
      match_dist_thr (float, optional): Matching distance threshold for
          word spotting. Defaults to None.
      collect_device (str): Device name used for collecting results from
          different ranks during distributed training. Must be 'cpu' or
          'gpu'. Defaults to 'cpu'.
      prefix (str, optional): The prefix that will be added in the metric
          names to disambiguate homonymous metrics of different evaluators.
          If prefix is not provided in the argument, self.default_prefix
          will be used instead. Defaults to None
docstr: Process one batch of data samples and predictions. 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 (Sequence[Dict]): A batch of data from dataloader.
      data_samples (Sequence[Dict]): A batch of outputs from
          the model.
docstr_tok: ["Process","one","batch","of","data","samples","and","predictions",".","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","(","Sequence","[","Dict","]",")",":","A","batch","of","data","from","dataloader",".","data_samples","(","Sequence","[","Dict","]",")",":","A","batch","of","outputs","from","the","model","."]
code: def process(
      self, data_batch: Sequence[Dict], data_samples: Sequence[Dict]
  ) -> None:
      """Process one batch of data samples and predictions. 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 (Sequence[Dict]): A batch of data from dataloader.
          data_samples (Sequence[Dict]): A batch of outputs from
              the model.
      """
      for data_sample in data_samples:
          pred_instances = data_sample.get("pred_instances")
          pred_points = pred_instances.get("points")
          text_scores = pred_instances.get("text_scores")
          if isinstance(text_scores, torch.Tensor):
              text_scores = text_scores.cpu().numpy()
          text_scores = np.array(text_scores, dtype=np.float32)
          pred_texts = pred_instances.get("texts")
  
          gt_instances = data_sample.get("gt_instances")
          gt_polys = gt_instances.get("polygons")
          gt_ignore_flags = gt_instances.get("ignored")
          gt_texts = gt_instances.get("texts")
          if isinstance(gt_ignore_flags, torch.Tensor):
              gt_ignore_flags = gt_ignore_flags.cpu().numpy()
  
          gt_points = [self.poly_center(poly) for poly in gt_polys]
          if self.word_spotting:
              gt_ignore_flags, gt_texts = self._word_spotting_filter(
                  gt_ignore_flags, gt_texts
              )
  
          pred_ignore_flags = text_scores < self.text_score_thrs.min()
          text_scores = text_scores[~pred_ignore_flags]
          pred_texts = self._get_true_elements(
              pred_texts, ~pred_ignore_flags
          )
          pred_points = self._get_true_elements(
              pred_points, ~pred_ignore_flags
          )
  
          result = dict(
              # reserved for image-level lexcions
              gt_img_name=osp.basename(data_sample.get("img_path", "")),
              text_scores=text_scores,
              pred_points=pred_points,
              gt_points=gt_points,
              pred_texts=pred_texts,
              gt_texts=gt_texts,
              gt_ignore_flags=gt_ignore_flags,
          )
          self.results.append(result)
  
imports: import glob
  import os.path
  import re
  from typing import Dict, List, Optional, Sequence, Tuple
  import numpy
  import torch
  from mmengine.evaluator import BaseMetric
  from mmengine.logging import MMLogger
  from rapidfuzz.distance import Levenshtein
  from shapely.geometry import Point
  from mmocr.registry import METRICS
label_desc: Use image node_id 5 for calling the E2EPointMetric obj's underlying member method code with example usage: obj.process(data_batch, data_samples) without return types