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_text (bool): Whether to parse and load the text annotation.
          Defaults to False.
code: def __init__(
      self,
      with_bbox: bool = False,
      with_label: bool = False,
      with_polygon: bool = False,
      with_text: bool = False,
      **kwargs,
  ) -> None:
      super().__init__(
          with_bbox=with_bbox, with_label=with_label, **kwargs
      )
      self.with_polygon = with_polygon
      self.with_text = with_text
      self.with_ignore = with_bbox or with_polygon
  
imports: import copy
  import warnings
  from typing import Optional, Union
  import mmcv
  import mmengine.fileio
  import numpy
  from mmcv.transforms import BaseTransform
  from mmcv.transforms import LoadAnnotations
  from mmcv.transforms import LoadImageFromFile
  from mmocr.registry import TRANSFORMS
label_desc: Use image node_id 1 to create a new LoadOCRAnnotations object from inherited base classes: MMCV_LoadAnnotations with example: obj = LoadOCRAnnotations(with_bbox, with_label, with_polygon, with_text)