code: def main():
      args = parse_args()
      root_path = args.root_path
      print("Processing training set...")
      training_infos = collect_hiertext_info(
          root_path, args.level, "train"
      )
      dump_ocr_data(
          training_infos,
          osp.join(root_path, "instances_training.json"),
          "textdet",
      )
      print("Processing validation set...")
      val_infos = collect_hiertext_info(root_path, args.level, "val")
      dump_ocr_data(
          val_infos,
          osp.join(root_path, "instances_val.json"),
          "textdet",
      )
      print("Finish")
  
file_path: mmocr/tools/dataset_converters/textdet/hiertext_converter.py
imports: import argparse
  import json
  import os.path
  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: main() without return types