class_docstr: Load and process the ``instances`` annotation provided by dataset.
  
  The annotation format is as the following:
  
  .. code-block:: python
  
      {
          'instances':
          [
              {
              # List of 4 numbers representing the bounding box of the
              # instance, in (x1, y1, x2, y2) order.
              # used in text detection or text spotting tasks.
              'bbox': [x1, y1, x2, y2],
  
              # Label of instance, usually it's 0.
              # used in text detection or text spotting tasks.
              'bbox_label': 0,
  
              # List of n numbers representing the polygon of the
              # instance, in (xn, yn) order.
              # used in text detection/ textspotter.
              "polygon": [x1, y1, x2, y2, ... xn, yn],
  
              # The flag indicating whether the instance should be ignored.
              # used in text detection or text spotting tasks.
              "ignore": False,
  
              # The groundtruth of text.
              # used in text recognition or text spotting tasks.
              "text": 'tmp',
              }
          ]
      }
  
  After this module, the annotation has been changed to the format below:
  
  .. code-block:: python
  
      {
          # In (x1, y1, x2, y2) order, float type. N is the number of bboxes
          # in np.float32
          'gt_bboxes': np.ndarray(N, 4)
           # In np.int64 type.
          'gt_bboxes_labels': np.ndarray(N, )
          # In (x1, y1,..., xk, yk) order, float type.
          # in list[np.float32]
          'gt_polygons': list[np.ndarray(2k, )]
           # In np.bool_ type.
          'gt_ignored': np.ndarray(N, )
           # In list[str]
          'gt_texts': list[str]
      }
  
  Required Keys:
  
  - instances
  
    - bbox (optional)
    - bbox_label (optional)
    - polygon (optional)
    - ignore (optional)
    - text (optional)
  
  Added Keys:
  
  - gt_bboxes (np.float32)
  - gt_bboxes_labels (np.int64)
  - gt_polygons (list[np.float32])
  - gt_ignored (np.bool_)
  - gt_texts (list[str])
  
  Args:
      with_bbox (bool): Whether to parse and load the bbox annotation.
          Defaults to False.
      with_label (bool): Whether to parse and load the label annotation.
          Defaults to False.
      with_polygon (bool): Whether to parse and load the polygon annotation.
          Defaults to False.
      with_bezier (bool): Whether to parse and load the bezier annotation.
          Defaults to False.
      with_text (bool): Whether to parse and load the text annotation.
          Defaults to False.
class_docstr_tok: ["Load","and","process","the","``","instances","``","annotation","provided","by","dataset",".","The","annotation","format","is","as","the","following",":","..","code-block",":",":","python","{","'instances","'",":","[","{","#","List","of","4","numbers","representing","the","bounding","box","of","the","#","instance",",","in","(","x1",",","y1",",","x2",",","y2",")","order",".","#","used","in","text","detection","or","text","spotting","tasks",".","'bbox","'",":","[","x1",",","y1",",","x2",",","y2","]",",","#","Label","of","instance",",","usually","it","'s","0",".","#","used","in","text","detection","or","text","spotting","tasks",".","'bbox_label","'",":","0",",","#","List","of","n","numbers","representing","the","polygon","of","the","#","instance",",","in","(","xn",",","yn",")","order",".","#","used","in","text","detection\/","textspotter",".","``","polygon","''",":","[","x1",",","y1",",","x2",",","y2",",","...","xn",",","yn","]",",","#","The","flag","indicating","whether","the","instance","should","be","ignored",".","#","used","in","text","detection","or","text","spotting","tasks",".","``","ignore","''",":","False",",","#","The","groundtruth","of","text",".","#","used","in","text","recognition","or","text","spotting","tasks",".","``","text","''",":","'tmp","'",",","}","]","}","After","this","module",",","the","annotation","has","been","changed","to","the","format","below",":","..","code-block",":",":","python","{","#","In","(","x1",",","y1",",","x2",",","y2",")","order",",","float","type",".","N","is","the","number","of","bboxes","#","in","np.float32","'gt_bboxes","'",":","np.ndarray","(","N",",","4",")","#","In","np.int64","type",".","'gt_bboxes_labels","'",":","np.ndarray","(","N",",",")","#","In","(","x1",",","y1",",","...",",","xk",",","yk",")","order",",","float","type",".","#","in","list","[","np.float32","]","'gt_polygons","'",":","list","[","np.ndarray","(","2k",",",")","]","#","In","np.bool_","type",".","'gt_ignored","'",":","np.ndarray","(","N",",",")","#","In","list","[","str","]","'gt_texts","'",":","list","[","str","]","}","Required","Keys",":","-","instances","-","bbox","(","optional",")","-","bbox_label","(","optional",")","-","polygon","(","optional",")","-","ignore","(","optional",")","-","text","(","optional",")","Added","Keys",":","-","gt_bboxes","(","np.float32",")","-","gt_bboxes_labels","(","np.int64",")","-","gt_polygons","(","list","[","np.float32","]",")","-","gt_ignored","(","np.bool_",")","-","gt_texts","(","list","[","str","]",")","Args",":","with_bbox","(","bool",")",":","Whether","to","parse","and","load","the","bbox","annotation",".","Defaults","to","False",".","with_label","(","bool",")",":","Whether","to","parse","and","load","the","label","annotation",".","Defaults","to","False",".","with_polygon","(","bool",")",":","Whether","to","parse","and","load","the","polygon","annotation",".","Defaults","to","False",".","with_bezier","(","bool",")",":","Whether","to","parse","and","load","the","bezier","annotation",".","Defaults","to","False",".","with_text","(","bool",")",":","Whether","to","parse","and","load","the","text","annotation",".","Defaults","to","False","."]
code: def __repr__(self) -> str:
      repr_str = self.__class__.__name__
      repr_str += f"(with_bbox={self.with_bbox}, "
      repr_str += f"with_label={self.with_label}, "
      repr_str += f"with_polygon={self.with_polygon}, "
      repr_str += f"with_bezier={self.with_bezier}, "
      repr_str += f"with_text={self.with_text}, "
      repr_str += f"imdecode_backend='{self.imdecode_backend}', "
  
      if self.file_client_args is not None:
          repr_str += f"file_client_args={self.file_client_args})"
      else:
          repr_str += f"backend_args={self.backend_args})"
  
      return repr_str
  
imports: import random
  from typing import Dict
  import numpy
  from mmcv.transforms.base import BaseTransform
  from mmocr.datasets.transforms import LoadOCRAnnotations
  from mmocr.registry import TASK_UTILS, TRANSFORMS
  from mmocr.utils import bezier2poly, poly2bezier
label_desc: Use image node_id 4 for calling the LoadOCRAnnotationsWithBezier obj's underlying member method code with example usage: obj.__repr__() and returns: repr_str