docstr: Constructor of Microsoft COCO helper class for reading and
  visualizing annotations.
  
  :param annotation_file (str | dict): location of annotation file or
      dict results.
  :param image_folder (str): location to the folder that hosts images.
  :return:
docstr_tok: ["Constructor","of","Microsoft","COCO","helper","class","for","reading","and","visualizing","annotations",".",":","param","annotation_file","(","str","|","dict",")",":","location","of","annotation","file","or","dict","results",".",":","param","image_folder","(","str",")",":","location","to","the","folder","that","hosts","images",".",":","return",":"]
code: def __init__(self, annotation_file=None):
      """Constructor of Microsoft COCO helper class for reading and
      visualizing annotations.
  
      :param annotation_file (str | dict): location of annotation file or
          dict results.
      :param image_folder (str): location to the folder that hosts images.
      :return:
      """
      # load dataset
      self.dataset, self.anns, self.cats, self.vids = (
          dict(),
          dict(),
          dict(),
          dict(),
      )
      self.vidToAnns, self.catToVids = defaultdict(list), defaultdict(
          list
      )
      if annotation_file is not None:
          print("loading annotations into memory...")
          tic = time.time()
          if type(annotation_file) == str:
              dataset = json.load(open(annotation_file, "r"))
          else:
              dataset = annotation_file
          assert (
              type(dataset) == dict
          ), "annotation file format {} not supported".format(
              type(dataset)
          )
          print("Done (t={:0.2f}s)".format(time.time() - tic))
          self.dataset = dataset
          self.createIndex()
  
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 1 to create a new YTVIS object  with example: obj = YTVIS(annotation_file)