class_docstr: HmeanIOU metric.
  
  This method computes the hmean iou metric, which is done in the
  following steps:
  
  - Filter the prediction polygon:
  
    - Scores is smaller than minimum prediction score threshold.
    - The proportion of the area that intersects with gt ignored polygon is
      greater than ignore_precision_thr.
  
  - Computing an M x N IoU matrix, where each element indexing
    E_mn represents the IoU between the m-th valid GT and n-th valid
    prediction.
  - Based on different prediction score threshold:
    - Obtain the ignored predictions according to prediction score.
      The filtered predictions will not be involved in the later metric
      computations.
    - Based on the IoU matrix, get the match metric according to
    ``match_iou_thr``.
    - Based on different `strategy`, accumulate the match number.
  - calculate H-mean under different prediction score threshold.
  
  Args:
      match_iou_thr (float): IoU threshold for a match. Defaults to 0.5.
      ignore_precision_thr (float): Precision threshold when prediction and            gt ignored polygons are matched. Defaults to 0.5.
      pred_score_thrs (dict): Best prediction score threshold searching
          space. Defaults to dict(start=0.3, stop=0.9, step=0.1).
      strategy (str): Polygon matching strategy. Options are 'max_matching'
          and 'vanilla'. 'max_matching' refers to the optimum strategy that
          maximizes the number of matches. Vanilla strategy matches gt and
          pred polygons if both of them are never matched before. It was used
          in MMOCR 0.x and and academia. Defaults to 'vanilla'.
      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
class_docstr_tok: ["HmeanIOU","metric",".","This","method","computes","the","hmean","iou","metric",",","which","is","done","in","the","following","steps",":","-","Filter","the","prediction","polygon",":","-","Scores","is","smaller","than","minimum","prediction","score","threshold",".","-","The","proportion","of","the","area","that","intersects","with","gt","ignored","polygon","is","greater","than","ignore_precision_thr",".","-","Computing","an","M","x","N","IoU","matrix",",","where","each","element","indexing","E_mn","represents","the","IoU","between","the","m-th","valid","GT","and","n-th","valid","prediction",".","-","Based","on","different","prediction","score","threshold",":","-","Obtain","the","ignored","predictions","according","to","prediction","score",".","The","filtered","predictions","will","not","be","involved","in","the","later","metric","computations",".","-","Based","on","the","IoU","matrix",",","get","the","match","metric","according","to","``","match_iou_thr","``",".","-","Based","on","different","`","strategy","`",",","accumulate","the","match","number",".","-","calculate","H-mean","under","different","prediction","score","threshold",".","Args",":","match_iou_thr","(","float",")",":","IoU","threshold","for","a","match",".","Defaults","to","0.5.","ignore_precision_thr","(","float",")",":","Precision","threshold","when","prediction","and","gt","ignored","polygons","are","matched",".","Defaults","to","0.5.","pred_score_thrs","(","dict",")",":","Best","prediction","score","threshold","searching","space",".","Defaults","to","dict","(","start=0.3",",","stop=0.9",",","step=0.1",")",".","strategy","(","str",")",":","Polygon","matching","strategy",".","Options","are","'max_matching'","and","'vanilla","'",".","'max_matching","'","refers","to","the","optimum","strategy","that","maximizes","the","number","of","matches",".","Vanilla","strategy","matches","gt","and","pred","polygons","if","both","of","them","are","never","matched","before",".","It","was","used","in","MMOCR","0.x","and","and","academia",".","Defaults","to","'vanilla","'",".","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"]
code: def __init__(
      self,
      match_iou_thr: float = 0.5,
      ignore_precision_thr: float = 0.5,
      pred_score_thrs: Dict = dict(start=0.3, stop=0.9, step=0.1),
      lexicon_path: Optional[str] = None,
      word_spotting: bool = False,
      min_length_case_word: int = 3,
      special_characters: str = "'!?.:,*\"()·[]/",
      strategy: str = "vanilla",
      collect_device: str = "cpu",
      prefix: Optional[str] = None,
  ) -> None:
      super().__init__(collect_device=collect_device, prefix=prefix)
      self.match_iou_thr = match_iou_thr
      self.ignore_precision_thr = ignore_precision_thr
      self.pred_score_thrs = np.arange(**pred_score_thrs)
      self.word_spotting = word_spotting
      self.min_length_case_word = min_length_case_word
      self.special_characters = special_characters
      assert strategy in ["max_matching", "vanilla"]
      self.strategy = strategy
  
imports: from typing import Dict, List, Optional, Sequence
  import numpy
  import torch
  from mmengine.evaluator import BaseMetric
  from mmengine.logging import MMLogger
  from scipy.sparse import csr_matrix
  from scipy.sparse.csgraph import maximum_bipartite_matching
  from shapely.geometry import Polygon
  from mmocr.evaluation.functional import compute_hmean
  from mmocr.registry import METRICS
  from mmocr.utils import poly_intersection, poly_iou, polys2shapely
label_desc: Use image node_id 1 to create a new E2EHmeanIOUMetric object from inherited base classes: BaseMetric with example: obj = E2EHmeanIOUMetric(match_iou_thr, ignore_precision_thr, pred_score_thrs, lexicon_path, word_spotting, min_length_case_word, special_characters, strategy, collect_device, prefix)