code: def parse_coco_json(in_path: str) -> List[Dict]:
      """Load coco annotations into image_infos parsable by dump_ocr_data().
  
      Args:
          in_path (str): COCO text annotation path.
  
      Returns:
          list[dict]: List of image information dicts. To be used by
          dump_ocr_data().
      """
      json_obj = mmengine.load(in_path)
      image_infos = json_obj["images"]
      annotations = json_obj["annotations"]
      imgid2annos = defaultdict(list)
      for anno in annotations:
          new_anno = deepcopy(anno)
          new_anno[
              "category_id"
          ] = 0  # Must be 0 for OCR tasks which stands
          # for "text" category
          imgid2annos[anno["image_id"]].append(new_anno)
  
      results = []
      for image_info in image_infos:
          image_info["anno_info"] = imgid2annos[image_info["id"]]
          results.append(image_info)
  
      return results
  
file_path: mmocr/tools/dataset_converters/textdet/data_migrator.py
imports: import argparse
  from collections import defaultdict
  from copy import deepcopy
  from typing import Dict, List
  import mmengine
  from mmocr.utils import dump_ocr_data
label_desc: Use image node_id 1 for calling a global function with example usage: parse_coco_json(in_path) and returns: results