code: def createIndex(self):
      # create index
      print("creating index...")
      anns, cats, vids = {}, {}, {}
      vidToAnns, catToVids = defaultdict(list), defaultdict(list)
      if "annotations" in self.dataset:
          for ann in self.dataset["annotations"]:
              vidToAnns[ann["video_id"]].append(ann)
              anns[ann["id"]] = ann
  
      if "videos" in self.dataset:
          for vid in self.dataset["videos"]:
              vids[vid["id"]] = vid
  
      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"]:
              catToVids[ann["category_id"]].append(ann["video_id"])
  
      print("index created!")
  
      # create class members
      self.anns = anns
      self.vidToAnns = vidToAnns
      self.catToVids = catToVids
      self.vids = vids
      self.cats = cats
  
imports: import copy
  import itertools
  import json
  import sys
  import time
  from collections import defaultdict
  import numpy
  from pycocotools import mask
label_desc: Use image node_id 2 for calling the YTVIS obj's underlying member method code with example usage: obj.createIndex() without return types