code: def convert_hiertext(
      root_path,
      split,
      level,
      preserve_vertical,
      nproc,
  ):
      """Collect the annotation information and crop the images.
  
      The annotation format is as the following:
      {
          "info": {
              "date": "release date",
              "version": "current version"
          },
          "annotations": [  // List of dictionaries, one for each image.
              {
              "image_id": "the filename of corresponding image.",
              "image_width": image_width,  // (int) The image width.
              "image_height": image_height, // (int) The image height.
              "paragraphs": [  // List of paragraphs.
                  {
                  "vertices": [[x1, y1], [x2, y2],...,[xn, yn]]
                  "legible": true
                  "lines": [
                      {
                      "vertices": [[x1, y1], [x2, y2],...,[x4, y4]]
                      "text": L
                      "legible": true,
                      "handwritten": false
                      "vertical": false,
                      "words": [
                          {
                          "vertices": [[x1, y1], [x2, y2],...,[xm, ym]]
                          "text": "the text content of this word",
                          "legible": true
                          "handwritten": false,
                          "vertical": false,
                          }, ...
                      ]
                      }, ...
                  ]
                  }, ...
              ]
              }, ...
          ]
          }
  
      Args:
          root_path (str): Root path to the dataset
          split (str): Dataset split, which should be 'train' or 'val'
          level (str): Crop word or line level instances
          preserve_vertical (bool): Whether to preserve vertical texts
          nproc (int): Number of processes
  
      Returns:
          img_info (dict): The dict of the img and annotation information
      """
  
      annotation_path = osp.join(
          root_path, "annotations/" + split + ".jsonl"
      )
      if not osp.exists(annotation_path):
          raise Exception(
              f"{annotation_path} not exists, please check and try again."
          )
  
      annotation = json.load(open(annotation_path))["annotations"]
      # outputs
      dst_label_file = osp.join(root_path, f"{split}_label.json")
      dst_image_root = osp.join(root_path, "crops", split)
      ignore_image_root = osp.join(root_path, "ignores", split)
      src_image_root = osp.join(root_path, "imgs", split)
      mmengine.mkdir_or_exist(dst_image_root)
      mmengine.mkdir_or_exist(ignore_image_root)
  
      process_img_with_path = partial(
          process_img,
          src_image_root=src_image_root,
          dst_image_root=dst_image_root,
          ignore_image_root=ignore_image_root,
          level=level,
          preserve_vertical=preserve_vertical,
          split=split,
      )
      tasks = []
      for img_idx, img_info in enumerate(annotation):
          tasks.append((img_idx, img_info))
      labels_list = mmengine.track_parallel_progress(
          process_img_with_path, tasks, keep_order=True, nproc=nproc
      )
  
      final_labels = []
      for label_list in labels_list:
          final_labels += label_list
  
      dump_ocr_data(final_labels, dst_label_file, "textrecog")
  
file_path: mmocr/tools/dataset_converters/textrecog/hiertext_converter.py
imports: import argparse
  import json
  import math
  import os.path
  from functools import partial
  import mmcv
  import mmengine
  import numpy
  from shapely.geometry import Polygon
  from mmocr.utils import dump_ocr_data
label_desc: Use image node_id 4 for calling a global function with example usage: convert_hiertext(root_path, split, level, preserve_vertical, nproc) without return types