code: def main():
      args = parse_args()
      root_path = args.root_path
      with mmengine.Timer(
          print_tmpl="It takes {}s to convert BID annotation"
      ):
          files = collect_files(
              osp.join(root_path, "imgs"),
              osp.join(root_path, "annotations"),
          )
          image_infos = collect_annotations(files, nproc=args.nproc)
          if args.val_ratio:
              image_infos = split_train_val_list(
                  image_infos, args.val_ratio
              )
              splits = ["training", "val"]
          else:
              image_infos = [image_infos]
              splits = ["training"]
          for i, split in enumerate(splits):
              dump_ocr_data(
                  image_infos[i],
                  osp.join(root_path, "instances_" + split + ".json"),
                  "textdet",
              )
  
file_path: mmocr/tools/dataset_converters/textdet/bid_converter.py
imports: import argparse
  import os
  import os.path
  import mmcv
  import mmengine
  from mmocr.utils import dump_ocr_data
label_desc: Use image node_id 7 for calling a global function with example usage: main() without return types