class_docstr: Dataset class for the COCO dataset that maps classes to PASCAL VOC classes
  
  Args:
      opts: command-line arguments
class_docstr_tok: ["Dataset","class","for","the","COCO","dataset","that","maps","classes","to","PASCAL","VOC","classes","Args",":","opts",":","command-line","arguments"]
docstr: Returns the sample corresponding to the input sample index. Returned sample is transformed
  into the size specified by the input.
  
  Args:
      sample_size_and_index: Tuple of the form (crop_size_h, crop_size_w, sample_index)
  
  Returns:
      A dictionary with `samples` and `targets` as keys corresponding to input and labels of
      a sample, respectively.
  
  Shapes:
      The shape of values in output dictionary, output_data, are as follows:
  
      output_data["samples"]["image"]: Shape is [Channels, Height, Width]
      output_data["targets"]["mask"]: Shape is [Height, Width]
docstr_tok: ["Returns","the","sample","corresponding","to","the","input","sample","index",".","Returned","sample","is","transformed","into","the","size","specified","by","the","input",".","Args",":","sample_size_and_index",":","Tuple","of","the","form","(","crop_size_h",",","crop_size_w",",","sample_index",")","Returns",":","A","dictionary","with","`","samples","`","and","`","targets","`","as","keys","corresponding","to","input","and","labels","of","a","sample",",","respectively",".","Shapes",":","The","shape","of","values","in","output","dictionary",",","output_data",",","are","as","follows",":","output_data","[","``","samples","''","]","[","``","image","''","]",":","Shape","is","[","Channels",",","Height",",","Width","]","output_data","[","``","targets","''","]","[","``","mask","''","]",":","Shape","is","[","Height",",","Width","]"]
code: def __getitem__(
      self, sample_size_and_index: Tuple[int, int, int], *args, **kwargs
  ) -> Mapping[str, Union[Tensor, Mapping[str, Tensor]]]:
      """Returns the sample corresponding to the input sample index. Returned sample is transformed
      into the size specified by the input.
  
      Args:
          sample_size_and_index: Tuple of the form (crop_size_h, crop_size_w, sample_index)
  
      Returns:
          A dictionary with `samples` and `targets` as keys corresponding to input and labels of
          a sample, respectively.
  
      Shapes:
          The shape of values in output dictionary, output_data, are as follows:
  
          output_data["samples"]["image"]: Shape is [Channels, Height, Width]
          output_data["targets"]["mask"]: Shape is [Height, Width]
  
      """
      crop_size_h, crop_size_w, img_index = sample_size_and_index
  
      _transform = self.get_augmentation_transforms(
          size=(crop_size_h, crop_size_w)
      )
  
      coco = self.coco
      img_id = self.ids[img_index]
      img_metadata = coco.loadImgs(img_id)[0]
      path = img_metadata["file_name"]
  
      rgb_img = self.read_image_pil(os.path.join(self.img_dir, path))
      cocotarget = coco.loadAnns(coco.getAnnIds(imgIds=img_id))
  
      mask = self._gen_seg_mask(
          cocotarget, img_metadata["height"], img_metadata["width"]
      )
  
      data = {
          "image": rgb_img,
          "mask": None if self.is_evaluation else mask,
      }
  
      data = _transform(data)
  
      if self.is_evaluation:
          # for evaluation purposes, resize only the input and not mask
          data["mask"] = mask
  
      output_data = {"samples": data["image"], "targets": data["mask"]}
  
      if self.is_evaluation:
          im_width, im_height = rgb_img.size
          img_name = path.replace("jpg", "png")
          mask = output_data.pop("targets")
          output_data["targets"] = {
              "mask": mask,
              "file_name": img_name,
              "im_width": im_width,
              "im_height": im_height,
          }
  
      return output_data
  
file_path: ml-cvnets/data/datasets/segmentation/coco_segmentation.py
imports: import argparse
  import os
  from typing import List, Mapping, Optional, Tuple, Union
  import numpy
  from pycocotools import mask
  from pycocotools.coco import COCO
  from torch import Tensor
  from data.datasets import DATASET_REGISTRY
  from data.datasets.segmentation.base_segmentation import BaseImageSegmentationDataset
label_desc: Use image node_id 2 for calling the COCOSegmentationDataset obj's underlying member method code with example usage: obj.__getitem__(sample_size_and_index) and returns: output_data