code: def __init__(
      self,
      annotations_filepath: Union[str, Path, dict],
      img_dir: Union[str, Path],
      idmap: Optional[IDMap] = None,
  ):
      if isinstance(annotations_filepath, dict):
          self.annotations_dict = annotations_filepath
      else:
          self.annotations_dict = json.loads(
              Path(annotations_filepath).read_bytes()
          )
      self.img_dir = Path(img_dir)
  
      self._record_id2info = {
          o["id"]: o for o in self.annotations_dict["images"]
      }
  
      categories = self.annotations_dict["categories"]
      id2class = {o["id"]: o["name"] for o in categories}
      id2class[0] = BACKGROUND
      # coco has non sequential ids, we fill the blanks with `None`, check #668 for more info
      classes = [None for _ in range(max(id2class.keys()) + 1)]
      for i, name in id2class.items():
          classes[i] = name
      self.class_map = ClassMap(classes)
  
      super().__init__(
          template_record=self.template_record(), idmap=idmap
      )
  
imports: from icevision.imports import *
  from icevision.core import *
  from icevision.utils import *
  from icevision.parsers import *
label_desc: Use image node_id 1 to create a new COCOBaseParser object from inherited base classes: Parser with example: obj = COCOBaseParser(annotations_filepath, img_dir, idmap)