code: def grit2odvg(args):
      annotations_dir = osp.join(args.data_root, "annotations")
      annos_files = [
          osp.join(annotations_dir, anno)
          for anno in os.listdir(annotations_dir)
          if anno.endswith(".json") and not anno.endswith("vg.json")
      ]
  
      annos_files = annos_files[:2]
  
      manager = multiprocessing.Manager()
      result_queue = manager.Queue()
      pool = multiprocessing.Pool(processes=min(len(annos_files), 16))
  
      for anno_file in annos_files:
          pool.apply_async(
              process_one_file, args=(anno_file, result_queue)
          )
  
      pool.close()
      pool.join()
  
      out_datas = []
      while not result_queue.empty():
          out_datas.extend(result_queue.get())
  
      out_path = osp.join(args.data_root, "grit20m_vg.json")
      with jsonlines.open(out_path, mode="w") as writer:
          writer.write_all(out_datas)
      print("save to ", out_path)
      print("total img: ", len(out_datas))
  
file_path: mmdetection/tools/dataset_converters/grit2odvg.py
imports: import argparse
  import json
  import multiprocessing
  import os
  import os.path
  import emoji
  import jsonlines
  from transformers import AutoTokenizer
label_desc: Use image node_id 3 for calling a global function with example usage: grit2odvg(args) without return types