code: def main():
      args = parse_args()
      root_path = args.root_path
      ratio = args.val_ratio
  
      trn_files, val_files = collect_files(
          osp.join(root_path, "imgs"),
          osp.join(root_path, "annotations"),
          ratio,
      )
  
      # Train set
      trn_infos = collect_annotations(trn_files, nproc=args.nproc)
      with mmengine.Timer(
          print_tmpl="It takes {}s to convert KAIST Training annotation"
      ):
          dump_ocr_data(
              trn_infos,
              osp.join(root_path, "instances_training.json"),
              "textdet",
          )
  
      # Val set
      if len(val_files) > 0:
          val_infos = collect_annotations(val_files, nproc=args.nproc)
          with mmengine.Timer(
              print_tmpl="It takes {}s to convert KAIST Val annotation"
          ):
              dump_ocr_data(
                  val_infos,
                  osp.join(root_path, "instances_val.json"),
                  "textdet",
              )
  
file_path: mmocr/tools/dataset_converters/textdet/kaist_converter.py
imports: import argparse
  import math
  import os
  import os.path
  import xml.etree.ElementTree
  import mmcv
  import mmengine
  from mmocr.utils import dump_ocr_data
label_desc: Use image node_id 6 for calling a global function with example usage: main() without return types