code: def __init__(
      self,
      data_dir="auto",
      split="train",
      year="2017",
      use_crowded=False,
  ):
      if year == "2017" and split in ["minival", "valminusminival"]:
          raise ValueError(
              "coco2017 dataset does not support given split: {}".format(
                  split
              )
          )
  
      super(COCOInstancesBaseDataset, self).__init__()
      self.use_crowded = use_crowded
  
      if split in ["val", "minival", "valminusminival"]:
          img_split = "val"
      else:
          img_split = "train"
      if data_dir == "auto":
          data_dir = get_coco(split, img_split, year, "instances")
  
      self.img_root = os.path.join(
          data_dir, "images", "{}{}".format(img_split, year)
      )
      anno_path = os.path.join(
          data_dir,
          "annotations",
          "instances_{}{}.json".format(split, year),
      )
  
      self.data_dir = data_dir
      annos = json.load(open(anno_path, "r"))
  
      self.id_to_prop = {}
      for prop in annos["images"]:
          self.id_to_prop[prop["id"]] = prop
      self.ids = sorted(list(self.id_to_prop.keys()))
  
      self.cat_ids = [cat["id"] for cat in annos["categories"]]
  
      self.id_to_anno = defaultdict(list)
      for anno in annos["annotations"]:
          self.id_to_anno[anno["image_id"]].append(anno)
  
      self.add_getter("img", self._get_image)
      self.add_getter("mask", self._get_mask)
      self.add_getter(
          ["bbox", "label", "area", "crowded"], self._get_annotations
      )
  
file_path: chainercv/chainercv/datasets/coco/coco_instances_base_dataset.py
imports: from collections import defaultdict
  import json
  import numpy
  import os
  import PIL.Image
  import PIL.ImageDraw
  from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
  from chainercv.datasets.coco.coco_utils import get_coco
  from chainercv import utils
label_desc: Use image node_id 1 to create a new COCOInstancesBaseDataset object from inherited base classes: GetterDataset with example: obj = COCOInstancesBaseDataset(data_dir, split, year, use_crowded)