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 __getitem__(self, index):
      coco = self.coco
      img_id = self.ids[index]
      img_metadata = coco.loadImgs(img_id)[0]
      path = img_metadata["file_name"]
      img = Image.open(os.path.join(self.root, path)).convert("RGB")
      cocotarget = coco.loadAnns(coco.getAnnIds(imgIds=img_id))
      mask = Image.fromarray(
          self._gen_seg_mask(
              cocotarget, img_metadata["height"], img_metadata["width"]
          )
      )
      # synchrosized transform
      if self.mode == "train":
          img, mask = self._sync_transform(img, mask)
      elif self.mode == "val":
          img, mask = self._val_sync_transform(img, mask)
      else:
          assert self.mode == "testval"
          img, mask = self._img_transform(img), self._mask_transform(
              mask
          )
      # general resize, normalize and toTensor
      if self.transform is not None:
          img = self.transform(img)
      return img, mask
  
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 2 for calling the COCOSegmentation obj's underlying member method code with example usage: obj.__getitem__(index) and returns: img,  mask