code: def gen_line_dict_file(out_path, imgid2imgname, imgid2anno):
      lines = []
      for key, value in imgid2imgname.items():
          if key in imgid2anno:
              anno = imgid2anno[key]
              line_dict = {}
              line_dict["file_name"] = value["file_name"]
              line_dict["height"] = value["height"]
              line_dict["width"] = value["width"]
              line_dict["annotations"] = anno
              lines.append(json.dumps(line_dict))
      list_to_file(out_path, lines)
  
imports: import argparse
  import json
  import mmengine
  from mmocr.utils import list_to_file
label_desc: Use image node_id 2 for calling a global function with example usage: gen_line_dict_file(out_path, imgid2imgname, imgid2anno) without return types