docstr: Constructor of Microsoft COCO helper class for reading and visualizing annotations.
  :param annotation_file (str): location of annotation file
  :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",")",":","location","of","annotation","file",":","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): location of annotation file
      :param image_folder (str): location to the folder that hosts images.
      :return:
      """
      # load dataset
      self.dataset, self.anns, self.cats, self.imgs = (
          dict(),
          dict(),
          dict(),
          dict(),
      )
      self.imgToAnns, self.catToImgs = defaultdict(list), defaultdict(
          list
      )
      if not annotation_file == None:
          print("loading annotations into memory...")
          tic = time.time()
          dataset = json.load(open(annotation_file, "r"))
          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 json
  import time
  import matplotlib.pyplot
  from matplotlib.collections import PatchCollection
  from matplotlib.patches import Polygon
  import numpy
  import copy
  import itertools
  from pycocotools import mask
  import os
  from collections import defaultdict
  import sys
label_desc: Use image node_id 1 to create a new COCO object  with example: obj = COCO(annotation_file)