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: Rescale results in ``results.pred_instances`` according to
  ``scale_factor``, whose keys are defined in ``self.rescale_fields``.
  Usually used to rescale bboxes and/or polygons.
  
  Args:
      results (TextDetDataSample): The post-processed prediction results.
      scale_factor (tuple(int)): (w_scale, h_scale)
  
  Returns:
      TextDetDataSample: Prediction results with rescaled results.
docstr_tok: ["Rescale","results","in","``","results.pred_instances","``","according","to","``","scale_factor","``",",","whose","keys","are","defined","in","``","self.rescale_fields","``",".","Usually","used","to","rescale","bboxes","and\/or","polygons",".","Args",":","results","(","TextDetDataSample",")",":","The","post-processed","prediction","results",".","scale_factor","(","tuple","(","int",")",")",":","(","w_scale",",","h_scale",")","Returns",":","TextDetDataSample",":","Prediction","results","with","rescaled","results","."]
code: def rescale(
      self, results: TextDetDataSample, scale_factor: Sequence[int]
  ) -> TextDetDataSample:
      """Rescale results in ``results.pred_instances`` according to
      ``scale_factor``, whose keys are defined in ``self.rescale_fields``.
      Usually used to rescale bboxes and/or polygons.
  
      Args:
          results (TextDetDataSample): The post-processed prediction results.
          scale_factor (tuple(int)): (w_scale, h_scale)
  
      Returns:
          TextDetDataSample: Prediction results with rescaled results.
      """
      scale_factor = np.asarray(scale_factor)
      for key in self.rescale_fields:
          results.pred_instances[key] = rescale_polygons(
              results.pred_instances[key], scale_factor, mode="div"
          )
      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 4 for calling the BaseTextDetPostProcessor obj's underlying member method code with example usage: obj.rescale(results, scale_factor) and returns: results