class_docstr: `MS Coco Detection <https://cocodataset.org/>`_ Dataset.
  
  Args:
      root (string): Root directory where images are downloaded to.
      dataset (string): train or val.
      transforms (callable, optional): A function/transform that takes input sample and its target as entry
          and returns a transformed version.
class_docstr_tok: ["`","MS","Coco","Detection","<","https",":","\/\/cocodataset.org\/",">","`","_","Dataset",".","Args",":","root","(","string",")",":","Root","directory","where","images","are","downloaded","to",".","dataset","(","string",")",":","train","or","val",".","transforms","(","callable",",","optional",")",":","A","function\/transform","that","takes","input","sample","and","its","target","as","entry","and","returns","a","transformed","version","."]
docstr: Args:
      index (int): Index
  
  Returns:
      tuple: Tuple (image, target). target is the object returned by ``coco.loadAnns``.
docstr_tok: ["Args",":","index","(","int",")",":","Index","Returns",":","tuple",":","Tuple","(","image",",","target",")",".","target","is","the","object","returned","by","``","coco.loadAnns","``","."]
code: def __getitem__(self, index):
      """
      Args:
          index (int): Index
  
      Returns:
          tuple: Tuple (image, target). target is the object returned by ``coco.loadAnns``.
      """
      coco = self.coco
      img_id = self.ids[index]
      ann_ids = coco.getAnnIds(imgIds=img_id)
      coco_target = coco.loadAnns(ann_ids)
  
      path = coco.loadImgs(img_id)[0]["file_name"]
      img = Image.open(os.path.join(self.img_root, path)).convert("RGB")
  
      w, h = img.size
      target = self.parse_targets(img_id, coco_target, w, h)
      if self.transforms is not None:
          img, target = self.transforms(img, target)
  
      return img, target
  
file_path: deep-learning-for-image-processing/pytorch_object_detection/mask_rcnn/my_dataset_coco.py
imports: import os
  import json
  import torch
  from PIL import Image
  import torch.utils.data
  from pycocotools.coco import COCO
  from train_utils import coco_remove_images_without_annotations, convert_coco_poly_mask
label_desc: Use image node_id 3 for calling the CocoDetection obj's underlying member method code with example usage: obj.__getitem__(index) and returns: img,  target