class_docstr: PostProcessor for SPTS.
  
  Args:
      dictionary (dict or :obj:`Dictionary`): The config for `Dictionary` or
          the instance of `Dictionary`.
      num_bins (int): Number of bins dividing the image. Defaults to 1000.
      rescale_fields (list[str], optional): The bbox/polygon field names to
          be rescaled. If None, no rescaling will be performed.
      max_seq_len (int): Maximum sequence length. In SPTS, a sequence
          encodes all the text instances in a sample. Defaults to 40, which
          will be overridden by SPTSDecoder.
      ignore_chars (list[str]): A list of characters to be ignored from the
          final results. Postprocessor will skip over these characters when
          converting raw indexes to characters. Apart from single characters,
          each item can be one of the following reversed keywords: 'padding',
          'end' and 'unknown', which refer to their corresponding special
          tokens in the dictionary.
class_docstr_tok: ["PostProcessor","for","SPTS",".","Args",":","dictionary","(","dict","or",":","obj",":","`","Dictionary","`",")",":","The","config","for","`","Dictionary","`","or","the","instance","of","`","Dictionary","`",".","num_bins","(","int",")",":","Number","of","bins","dividing","the","image",".","Defaults","to","1000.","rescale_fields","(","list","[","str","]",",","optional",")",":","The","bbox\/polygon","field","names","to","be","rescaled",".","If","None",",","no","rescaling","will","be","performed",".","max_seq_len","(","int",")",":","Maximum","sequence","length",".","In","SPTS",",","a","sequence","encodes","all","the","text","instances","in","a","sample",".","Defaults","to","40",",","which","will","be","overridden","by","SPTSDecoder",".","ignore_chars","(","list","[","str","]",")",":","A","list","of","characters","to","be","ignored","from","the","final","results",".","Postprocessor","will","skip","over","these","characters","when","converting","raw","indexes","to","characters",".","Apart","from","single","characters",",","each","item","can","be","one","of","the","following","reversed","keywords",":","'padding","'",",","'end","'","and","'unknown","'",",","which","refer","to","their","corresponding","special","tokens","in","the","dictionary","."]
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 (TextSpottingDataSample): 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","(","TextSpottingDataSample",")",":","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: TextSpottingDataSample, scale_factor: Sequence[int]
  ) -> TextSpottingDataSample:
      """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 (TextSpottingDataSample): 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:
          # TODO: this util may need an alias or to be renamed
          results.pred_instances[key] = rescale_polygons(
              results.pred_instances[key], scale_factor, mode="div"
          )
      return results
  
file_path: mmocr/projects/SPTS/spts/model/spts_postprocessor.py
imports: from typing import Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from mmocr.models import Dictionary
  from mmocr.models.textrecog.postprocessors import BaseTextRecogPostprocessor
  from mmocr.registry import MODELS
  from mmocr.structures import TextSpottingDataSample
  from mmocr.utils import rescale_polygons
label_desc: Use image node_id 4 for calling the SPTSPostprocessor obj's underlying member method code with example usage: obj.rescale(results, scale_factor) and returns: results