class_docstr: `Pascal VOC <http://host.robots.ox.ac.uk/pascal/VOC/>`_ Segmentation Dataset.
  
  Args:
      root (string): Root directory of the VOC Dataset.
      year (string, optional): The dataset year, supports years ``"2007"`` to ``"2012"``.
      image_set (string, optional): Select the image_set to use, ``"train"``, ``"trainval"`` or ``"val"``. If
          ``year=="2007"``, can also be ``"test"``.
      download (bool, optional): If true, downloads the dataset from the internet and
          puts it in root directory. If dataset is already downloaded, it is not
          downloaded again.
      transform (callable, optional): A function/transform that  takes in a PIL image
          and returns a transformed version. E.g, ``transforms.RandomCrop``
      target_transform (callable, optional): A function/transform that takes in the
          target and transforms it.
      transforms (callable, optional): A function/transform that takes input sample and its target as entry
          and returns a transformed version.
class_docstr_tok: ["`","Pascal","VOC","<","http",":","\/\/host.robots.ox.ac.uk\/pascal\/VOC\/",">","`","_","Segmentation","Dataset",".","Args",":","root","(","string",")",":","Root","directory","of","the","VOC","Dataset",".","year","(","string",",","optional",")",":","The","dataset","year",",","supports","years","``","``","2007","''","``","to","``","``","2012","''","``",".","image_set","(","string",",","optional",")",":","Select","the","image_set","to","use",",","``","``","train","''","``",",","``","``","trainval","''","``","or","``","``","val","''","``",".","If","``","year==","''","2007","''","``",",","can","also","be","``","``","test","''","``",".","download","(","bool",",","optional",")",":","If","true",",","downloads","the","dataset","from","the","internet","and","puts","it","in","root","directory",".","If","dataset","is","already","downloaded",",","it","is","not","downloaded","again",".","transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","a","PIL","image","and","returns","a","transformed","version",".","E.g",",","``","transforms.RandomCrop","``","target_transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","the","target","and","transforms","it",".","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: (image, target) where target is the image segmentation.
docstr_tok: ["Args",":","index","(","int",")",":","Index","Returns",":","tuple",":","(","image",",","target",")","where","target","is","the","image","segmentation","."]
code: def __getitem__(self, index: int) -> Tuple[Any, Any]:
      """
      Args:
          index (int): Index
  
      Returns:
          tuple: (image, target) where target is the image segmentation.
      """
      img = Image.open(self.images[index]).convert("RGB")
      target = Image.open(self.masks[index])
  
      if self.transforms is not None:
          img, target = self.transforms(img, target)
  
      return img, target
  
file_path: vision/torchvision/datasets/voc.py
imports: import collections
  import os
  from xml.etree.ElementTree import Element
  from .vision import VisionDataset
  from typing import Any, Callable, Dict, List, Optional, Tuple
  from PIL import Image
  from .utils import download_and_extract_archive, verify_str_arg
label_desc: Use image node_id 2 for calling the VOCSegmentation obj's underlying member method code with example usage: obj.__getitem__(index) and returns: img,  target