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: Convert outputs to strings and scores.
  
  Args:
      output (tuple(Tensor, Tensor)): A tuple of (probs, seq), each has
          the shape of :math:`(T,)`.
      data_samples (list[TextSpottingDataSample]): The list of
          TextSpottingDataSample.
  
  Returns:
      list(TextSpottingDataSample): The list of TextSpottingDataSample.
docstr_tok: ["Convert","outputs","to","strings","and","scores",".","Args",":","output","(","tuple","(","Tensor",",","Tensor",")",")",":","A","tuple","of","(","probs",",","seq",")",",","each","has","the","shape","of",":","math",":","`","(","T",",",")","`",".","data_samples","(","list","[","TextSpottingDataSample","]",")",":","The","list","of","TextSpottingDataSample",".","Returns",":","list","(","TextSpottingDataSample",")",":","The","list","of","TextSpottingDataSample","."]
code: def __call__(
      self,
      output: Tuple[torch.Tensor, torch.Tensor],
      data_samples: Sequence[TextSpottingDataSample],
  ) -> Sequence[TextSpottingDataSample]:
      """Convert outputs to strings and scores.
  
      Args:
          output (tuple(Tensor, Tensor)): A tuple of (probs, seq), each has
              the shape of :math:`(T,)`.
          data_samples (list[TextSpottingDataSample]): The list of
              TextSpottingDataSample.
  
      Returns:
          list(TextSpottingDataSample): The list of TextSpottingDataSample.
      """
      max_probs, seq = output
      batch_size = max_probs.size(0)
  
      for idx in range(batch_size):
          (
              char_idxs,
              text_scores,
              points,
              pt_scores,
          ) = self.get_single_prediction(
              max_probs[idx, :], seq[idx, :], data_samples[idx]
          )
          texts = []
          scores = []
          for index, pt_score in zip(char_idxs, pt_scores):
              text = self.dictionary.idx2str(index)
              texts.append(text)
              # the "scores" field only accepts a float number
              scores.append(np.mean(pt_score).item())
          pred_instances = InstanceData()
          pred_instances.texts = texts
          pred_instances.scores = scores
          pred_instances.text_scores = text_scores
          pred_instances.points = points
          data_samples[idx].pred_instances = pred_instances
          pred_instances = self.rescale(
              data_samples[idx], data_samples[idx].scale_factor
          )
      return data_samples
  
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 3 for calling the SPTSPostprocessor obj's underlying member method code with example usage: obj.__call__(output, data_samples) and returns: data_samples