class_docstr: SynthText Text Detection Annotation Parser.
  
  Args:
      split (str): The split of the dataset. It is usually set automatically
          and users do not need to set it manually in config file in most
          cases.
      nproc (int): Number of processes to process the data. Defaults to 1.
          It is usually set automatically and users do not need to set it
          manually in config file in most cases.
      separator (str): The separator between each element in a line. Defaults
          to ','.
      ignore (str): The text to be ignored. Defaults to '###'.
      format (str): The format of the annotation. Defaults to
          'x1,y1,x2,y2,x3,y3,x4,trans'.
      encoding (str): The encoding of the annotation file. Defaults to
          'utf-8-sig'.
      remove_strs (List[str], Optional): Used to remove redundant strings in
          the transcription. Defaults to None.
      mode (str, optional): The mode of the box converter. Supported modes
          are 'xywh' and 'xyxy'. Defaults to None.
class_docstr_tok: ["SynthText","Text","Detection","Annotation","Parser",".","Args",":","split","(","str",")",":","The","split","of","the","dataset",".","It","is","usually","set","automatically","and","users","do","not","need","to","set","it","manually","in","config","file","in","most","cases",".","nproc","(","int",")",":","Number","of","processes","to","process","the","data",".","Defaults","to","1",".","It","is","usually","set","automatically","and","users","do","not","need","to","set","it","manually","in","config","file","in","most","cases",".","separator","(","str",")",":","The","separator","between","each","element","in","a","line",".","Defaults","to","'",",","'",".","ignore","(","str",")",":","The","text","to","be","ignored",".","Defaults","to","'","#","#","#","'",".","format","(","str",")",":","The","format","of","the","annotation",".","Defaults","to","'x1",",","y1",",","x2",",","y2",",","x3",",","y3",",","x4",",","trans","'",".","encoding","(","str",")",":","The","encoding","of","the","annotation","file",".","Defaults","to","'utf-8-sig","'",".","remove_strs","(","List","[","str","]",",","Optional",")",":","Used","to","remove","redundant","strings","in","the","transcription",".","Defaults","to","None",".","mode","(","str",",","optional",")",":","The","mode","of","the","box","converter",".","Supported","modes","are","'xywh","'","and","'xyxy","'",".","Defaults","to","None","."]
docstr: Convert annotations to MMOCR format.
  
  Args:
      img_paths (str or list[str]): the list of image paths or the
          directory of the images.
      ann_paths (str or list[str]): the list of annotation paths or the
          path of the annotation file which contains all the annotations.
  
  Returns:
      List[Tuple]: A list of a tuple of (image_path, instances).
  
      - img_path (str): The path of image file, which can be read
        directly by opencv.
      - instance: instance is a list of dict containing parsed
        annotations, which should contain the following keys:
  
        - 'poly' or 'box' (textdet or textspotting)
        - 'text' (textspotting or textrecog)
        - 'ignore' (all task)
docstr_tok: ["Convert","annotations","to","MMOCR","format",".","Args",":","img_paths","(","str","or","list","[","str","]",")",":","the","list","of","image","paths","or","the","directory","of","the","images",".","ann_paths","(","str","or","list","[","str","]",")",":","the","list","of","annotation","paths","or","the","path","of","the","annotation","file","which","contains","all","the","annotations",".","Returns",":","List","[","Tuple","]",":","A","list","of","a","tuple","of","(","image_path",",","instances",")",".","-","img_path","(","str",")",":","The","path","of","image","file",",","which","can","be","read","directly","by","opencv",".","-","instance",":","instance","is","a","list","of","dict","containing","parsed","annotations",",","which","should","contain","the","following","keys",":","-","'poly","'","or","'box","'","(","textdet","or","textspotting",")","-","'text","'","(","textspotting","or","textrecog",")","-","'ignore","'","(","all","task",")"]
code: def parse_files(
      self,
      img_paths: Union[List[str], str],
      ann_paths: Union[List[str], str],
  ) -> List[Tuple]:
      """Convert annotations to MMOCR format.
  
      Args:
          img_paths (str or list[str]): the list of image paths or the
              directory of the images.
          ann_paths (str or list[str]): the list of annotation paths or the
              path of the annotation file which contains all the annotations.
  
      Returns:
          List[Tuple]: A list of a tuple of (image_path, instances).
  
          - img_path (str): The path of image file, which can be read
            directly by opencv.
          - instance: instance is a list of dict containing parsed
            annotations, which should contain the following keys:
  
            - 'poly' or 'box' (textdet or textspotting)
            - 'text' (textspotting or textrecog)
            - 'ignore' (all task)
      """
      assert isinstance(ann_paths, str)
      gt = loadmat(ann_paths)
      self.img_dir = img_paths
      samples = track_parallel_progress(
          self.parse_file,
          list(
              zip(
                  gt["imnames"][0],
                  gt["wordBB"][0],
                  gt["charBB"][0],
                  gt["txt"][0],
              )
          ),
          nproc=self.nproc,
      )
      return samples
  
file_path: mmocr/mmocr/datasets/preparers/parsers/synthtext_parser.py
imports: import os.path
  from typing import List, Optional, Tuple, Union
  import numpy
  from mmengine import track_parallel_progress
  from scipy.io import loadmat
  from mmocr.utils import is_type_list
  from ..data_preparer import DATA_PARSERS
  from .base import BaseParser
label_desc: Use image node_id 4 for calling the SynthTextAnnParser obj's underlying member method code with example usage: obj.parse_files(img_paths, ann_paths) and returns: samples