code: def convert_to_dict(annotations):
      result_dict = defaultdict(list)
      for obj in annotations:
          image_id = obj["image_id"]
          result_dict[image_id].append(obj)
      return result_dict
  
file_path: pytorch-toolbelt/pytorch_toolbelt/datasets/providers/coco_detection.py
imports: import dataclasses
  import json
  import os.path
  from collections import defaultdict
  from typing import List
  import numpy
  from torch.utils.data import Dataset
label_desc: Use image node_id 4 for calling the COCODetectionDatasetReader obj's underlying member method code with example usage: obj.convert_to_dict(annotations) and returns: result_dict