code: def createIndex(self):
      # create index
      # print('creating index...')
      anns, cats, imgs = {}, {}, {}
      imgToAnns, catToImgs = defaultdict(list), defaultdict(list)
      if "annotations" in self.dataset:
          for ann in self.dataset["annotations"]:
              imgToAnns[ann["image_id"]].append(ann)
              anns[ann["id"]] = ann
  
      if "images" in self.dataset:
          for img in self.dataset["images"]:
              imgs[img["id"]] = img
  
      if "categories" in self.dataset:
          for cat in self.dataset["categories"]:
              cats[cat["id"]] = cat
  
      if "annotations" in self.dataset and "categories" in self.dataset:
          for ann in self.dataset["annotations"]:
              catToImgs[ann["category_id"]].append(ann["image_id"])
  
      # print('index created!')
  
      # create class members
      self.anns = anns
      self.imgToAnns = imgToAnns
      self.catToImgs = catToImgs
      self.imgs = imgs
      self.cats = cats
  
imports: import json
  from collections import defaultdict
  import numpy
  import copy
  import torch
  import torch._six
  from pycocotools.cocoeval import COCOeval
  from pycocotools.coco import COCO
  import pycocotools.mask
  from train_utils.distributed_utils import all_gather
label_desc: Use image node_id 4 for calling a global function with example usage: createIndex() without return types