class_docstr: This wrapper is for loading the panoptic style annotation file.
  
  The format is shown in the CocoPanopticDataset class.
  
  Args:
      annotation_file (str, optional): Path of annotation file.
          Defaults to None.
class_docstr_tok: ["This","wrapper","is","for","loading","the","panoptic","style","annotation","file",".","The","format","is","shown","in","the","CocoPanopticDataset","class",".","Args",":","annotation_file","(","str",",","optional",")",":","Path","of","annotation","file",".","Defaults","to","None","."]
docstr: Create index.
docstr_tok: ["Create","index","."]
code: def createIndex(self) -> None:
      """Create index."""
      # create index
      print("creating index...")
      # anns stores 'segment_id -> annotation'
      anns, cats, imgs = {}, {}, {}
      img_to_anns, cat_to_imgs = defaultdict(list), defaultdict(list)
      if "annotations" in self.dataset:
          for ann in self.dataset["annotations"]:
              for seg_ann in ann["segments_info"]:
                  # to match with instance.json
                  seg_ann["image_id"] = ann["image_id"]
                  img_to_anns[ann["image_id"]].append(seg_ann)
                  # segment_id is not unique in coco dataset orz...
                  # annotations from different images but
                  # may have same segment_id
                  if seg_ann["id"] in anns.keys():
                      anns[seg_ann["id"]].append(seg_ann)
                  else:
                      anns[seg_ann["id"]] = [seg_ann]
  
          # filter out annotations from other images
          img_to_anns_ = defaultdict(list)
          for k, v in img_to_anns.items():
              img_to_anns_[k] = [x for x in v if x["image_id"] == k]
          img_to_anns = img_to_anns_
  
      if "images" in self.dataset:
          for img_info in self.dataset["images"]:
              img_info["segm_file"] = img_info["file_name"].replace(
                  "jpg", "png"
              )
              imgs[img_info["id"]] = img_info
  
      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"]:
              for seg_ann in ann["segments_info"]:
                  cat_to_imgs[seg_ann["category_id"]].append(
                      ann["image_id"]
                  )
  
      print("index created!")
  
      self.anns = anns
      self.imgToAnns = img_to_anns
      self.catToImgs = cat_to_imgs
      self.imgs = imgs
      self.cats = cats
  
file_path: mmdetection/projects/EfficientDet/efficientdet/tensorflow/api_wrappers/coco_api.py
imports: import warnings
  from collections import defaultdict
  from typing import List, Optional, Union
  import pycocotools
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
label_desc: Use image node_id 2 for calling the COCOPanoptic obj's underlying member method code with example usage: obj.createIndex() without return types