class_docstr: Generate data from the COCO dataset.
  
  See https://github.com/cocodataset/cocoapi/tree/master/PythonAPI for more information.
class_docstr_tok: ["Generate","data","from","the","COCO","dataset",".","See","https",":","\/\/github.com\/cocodataset\/cocoapi\/tree\/master\/PythonAPI","for","more","information","."]
docstr: Loads the class to label mapping (and inverse) for COCO.
          
docstr_tok: ["Loads","the","class","to","label","mapping","(","and","inverse",")","for","COCO","."]
code: def load_classes(self):
      """Loads the class to label mapping (and inverse) for COCO."""
      # load class names (name -> label)
      categories = self.coco.loadCats(self.coco.getCatIds())
      categories.sort(key=lambda x: x["id"])
  
      self.classes = {}
      self.coco_labels = {}
      self.coco_labels_inverse = {}
      for c in categories:
          self.coco_labels[len(self.classes)] = c["id"]
          self.coco_labels_inverse[c["id"]] = len(self.classes)
          self.classes[c["name"]] = len(self.classes)
  
      # also load the reverse (label -> name)
      self.labels = {}
      for key, value in self.classes.items():
          self.labels[value] = key
  
imports: from ..preprocessing.generator import Generator
  from ..utils.image import read_image_bgr
  import os
  import numpy
  from pycocotools.coco import COCO
label_desc: Use image node_id 2 for calling the CocoGenerator obj's underlying member method code with example usage: obj.load_classes() without return types