docstr: Args:
      basedir (str): root of the dataset which contains the subdirectories for each split and annotations
      split (str): the name of the split, e.g. "train2017".
          The split has to match an annotation file in "annotations/" and a directory of images.
  
  Examples:
      For a directory of this structure:
  
      DIR/
        annotations/
          instances_XX.json
          instances_YY.json
        XX/
        YY/
  
      use `COCODetection(DIR, 'XX')` and `COCODetection(DIR, 'YY')`
docstr_tok: ["Args",":","basedir","(","str",")",":","root","of","the","dataset","which","contains","the","subdirectories","for","each","split","and","annotations","split","(","str",")",":","the","name","of","the","split",",","e.g",".","``","train2017","''",".","The","split","has","to","match","an","annotation","file","in","``","annotations\/","''","and","a","directory","of","images",".","Examples",":","For","a","directory","of","this","structure",":","DIR\/","annotations\/","instances_XX.json","instances_YY.json","XX\/","YY\/","use","`","COCODetection","(","DIR",",","'XX","'",")","`","and","`","COCODetection","(","DIR",",","'YY","'",")","`"]
code: def __init__(self, basedir, split):
      """
      Args:
          basedir (str): root of the dataset which contains the subdirectories for each split and annotations
          split (str): the name of the split, e.g. "train2017".
              The split has to match an annotation file in "annotations/" and a directory of images.
  
      Examples:
          For a directory of this structure:
  
          DIR/
            annotations/
              instances_XX.json
              instances_YY.json
            XX/
            YY/
  
          use `COCODetection(DIR, 'XX')` and `COCODetection(DIR, 'YY')`
      """
      basedir = os.path.expanduser(basedir)
      self._imgdir = os.path.realpath(
          os.path.join(
              basedir, self._INSTANCE_TO_BASEDIR.get(split, split)
          )
      )
      assert os.path.isdir(
          self._imgdir
      ), "{} is not a directory!".format(self._imgdir)
      annotation_file = os.path.join(
          basedir, "annotations/instances_{}.json".format(split)
      )
      assert os.path.isfile(annotation_file), annotation_file
  
      from pycocotools.coco import COCO
  
      self.coco = COCO(annotation_file)
      self.annotation_file = annotation_file
      logger.info("Instances loaded from {}.".format(annotation_file))
  
file_path: tensorpack/examples/FasterRCNN/dataset/coco.py
imports: import json
  import numpy
  import os
  import tqdm
  from tensorpack.utils import logger
  from tensorpack.utils.timer import timed_operation
  from config import config
  from dataset import DatasetRegistry, DatasetSplit
label_desc: Use image node_id 1 to create a new COCODetection object from inherited base classes: DatasetSplit with example: obj = COCODetection(basedir, split)