class_docstr: COCO Semantic Segmentation Dataset for VOC Pre-training.
  
  Parameters
  ----------
  root : string
      Path to COCO folder. Default is '$(HOME)/mxnet/datasets/coco'
  split: string
      'train', 'val' or 'test'
  transform : callable, optional
      A function that transforms the image
  
  Examples
  --------
  >>> from mxnet.gluon.data.vision import transforms
  >>> # Transforms for Normalization
  >>> input_transform = transforms.Compose([
  >>>     transforms.ToTensor(),
  >>>     transforms.Normalize([.485, .456, .406], [.229, .224, .225]),
  >>> ])
  >>> # Create Dataset
  >>> trainset = gluoncv.data.COCOSegmentation(split='train', transform=input_transform)
  >>> # Create Training Loader
  >>> train_data = gluon.data.DataLoader(
  >>>     trainset, 4, shuffle=True, last_batch='rollover',
  >>>     num_workers=4)
class_docstr_tok: ["COCO","Semantic","Segmentation","Dataset","for","VOC","Pre-training",".","Parameters","--","--","--","--","--","root",":","string","Path","to","COCO","folder",".","Default","is","'","$","(","HOME",")","\/mxnet\/datasets\/coco'","split",":","string","'train","'",",","'val","'","or","'test'","transform",":","callable",",","optional","A","function","that","transforms","the","image","Examples","--","--","--","--",">",">",">","from","mxnet.gluon.data.vision","import","transforms",">",">",">","#","Transforms","for","Normalization",">",">",">","input_transform","=","transforms.Compose","(","[",">",">",">","transforms.ToTensor","(",")",",",">",">",">","transforms.Normalize","(","[",".485",",",".456",",",".406","]",",","[",".229",",",".224",",",".225","]",")",",",">",">",">","]",")",">",">",">","#","Create","Dataset",">",">",">","trainset","=","gluoncv.data.COCOSegmentation","(","split='train","'",",","transform=input_transform",")",">",">",">","#","Create","Training","Loader",">",">",">","train_data","=","gluon.data.DataLoader","(",">",">",">","trainset",",","4",",","shuffle=True",",","last_batch='rollover","'",",",">",">",">","num_workers=4",")"]
code: def __init__(
      self,
      root=os.path.expanduser("~/.mxnet/datasets/coco"),
      split="train",
      mode=None,
      transform=None,
      **kwargs,
  ):
      super(COCOSegmentation, self).__init__(
          root, split, mode, transform, **kwargs
      )
      # lazy import pycocotools
      try_import_pycocotools()
      from pycocotools.coco import COCO
      from pycocotools import mask
  
      if split == "train":
          print("train set")
          ann_file = os.path.join(
              root, "annotations/instances_train2017.json"
          )
          ids_file = os.path.join(root, "annotations/train_ids.mx")
          self.root = os.path.join(root, "train2017")
      else:
          print("val set")
          ann_file = os.path.join(
              root, "annotations/instances_val2017.json"
          )
          ids_file = os.path.join(root, "annotations/val_ids.mx")
          self.root = os.path.join(root, "val2017")
      self.coco = COCO(ann_file)
      self.coco_mask = mask
      if os.path.exists(ids_file):
          with open(ids_file, "rb") as f:
              self.ids = pickle.load(f)
      else:
          ids = list(self.coco.imgs.keys())
          self.ids = self._preprocess(ids, ids_file)
      self.transform = transform
  
file_path: gluon-cv/gluoncv/data/mscoco/segmentation.py
imports: import os
  import pickle
  from tqdm import trange
  from PIL import Image
  import numpy
  from .utils import try_import_pycocotools
  from ..segbase import SegmentationDataset
label_desc: Use image node_id 1 to create a new COCOSegmentation object from inherited base classes: SegmentationDataset with example: obj = COCOSegmentation(root, split, mode, transform)