class_docstr: Base postprocessor for text detection models.
  
  Args:
      text_repr_type (str): The boundary encoding type, 'poly' or 'quad'.
          Defaults to 'poly'.
      rescale_fields (list[str], optional): The bbox/polygon field names to
          be rescaled. If None, no rescaling will be performed.
      train_cfg (dict, optional): The parameters to be passed to
          ``self.get_text_instances`` in training. Defaults to None.
      test_cfg (dict, optional): The parameters to be passed to
          ``self.get_text_instances`` in testing. Defaults to None.
class_docstr_tok: ["Base","postprocessor","for","text","detection","models",".","Args",":","text_repr_type","(","str",")",":","The","boundary","encoding","type",",","'poly","'","or","'quad","'",".","Defaults","to","'poly","'",".","rescale_fields","(","list","[","str","]",",","optional",")",":","The","bbox\/polygon","field","names","to","be","rescaled",".","If","None",",","no","rescaling","will","be","performed",".","train_cfg","(","dict",",","optional",")",":","The","parameters","to","be","passed","to","``","self.get_text_instances","``","in","training",".","Defaults","to","None",".","test_cfg","(","dict",",","optional",")",":","The","parameters","to","be","passed","to","``","self.get_text_instances","``","in","testing",".","Defaults","to","None","."]
docstr: Postprocess pred_results according to metainfos in data_samples.
  
  Args:
      pred_results (Union[Tensor, List[Tensor]]): The prediction results
          stored in a tensor or a list of tensor. Usually each item to
          be post-processed is expected to be a batched tensor.
      data_samples (list[TextDetDataSample]): Batch of data_samples,
          each corresponding to a prediction result.
      training (bool): Whether the model is in training mode. Defaults to
          False.
  
  Returns:
      list[TextDetDataSample]: Batch of post-processed datasamples.
docstr_tok: ["Postprocess","pred_results","according","to","metainfos","in","data_samples",".","Args",":","pred_results","(","Union","[","Tensor",",","List","[","Tensor","]","]",")",":","The","prediction","results","stored","in","a","tensor","or","a","list","of","tensor",".","Usually","each","item","to","be","post-processed","is","expected","to","be","a","batched","tensor",".","data_samples","(","list","[","TextDetDataSample","]",")",":","Batch","of","data_samples",",","each","corresponding","to","a","prediction","result",".","training","(","bool",")",":","Whether","the","model","is","in","training","mode",".","Defaults","to","False",".","Returns",":","list","[","TextDetDataSample","]",":","Batch","of","post-processed","datasamples","."]
code: def __call__(
      self,
      pred_results: Union[Tensor, List[Tensor]],
      data_samples: Sequence[TextDetDataSample],
      training: bool = False,
  ) -> Sequence[TextDetDataSample]:
      """Postprocess pred_results according to metainfos in data_samples.
  
      Args:
          pred_results (Union[Tensor, List[Tensor]]): The prediction results
              stored in a tensor or a list of tensor. Usually each item to
              be post-processed is expected to be a batched tensor.
          data_samples (list[TextDetDataSample]): Batch of data_samples,
              each corresponding to a prediction result.
          training (bool): Whether the model is in training mode. Defaults to
              False.
  
      Returns:
          list[TextDetDataSample]: Batch of post-processed datasamples.
      """
      cfg = self.train_cfg if training else self.test_cfg
      if cfg is None:
          cfg = {}
      pred_results = self.split_results(pred_results)
      process_single = partial(self._process_single, **cfg)
      results = list(map(process_single, pred_results, data_samples))
  
      return results
  
file_path: mmocr/mmocr/models/textdet/postprocessors/base.py
imports: from functools import partial
  from typing import Dict, List, Optional, Sequence, Tuple, Union
  import mmengine
  import numpy
  from torch import Tensor
  from mmocr.structures import TextDetDataSample
  from mmocr.utils import boundary_iou, rescale_polygons
label_desc: Use image node_id 2 for calling the BaseTextDetPostProcessor obj's underlying member method code with example usage: obj.__call__(pred_results, data_samples, training) and returns: results