class_docstr: ADE20K dataset `http://sceneparsing.csail.mit.edu/`.
  
  Args:
      transforms (list): A list of image transformations.
      dataset_root (str, optional): The ADK20K dataset directory. Default: None.
      mode (str, optional): A subset of the entire dataset. It should be one of ('train', 'val'). Default: 'train'.
      edge (bool, optional): Whether to compute edge while training. Default: False
class_docstr_tok: ["ADE20K","dataset","`","http",":","\/\/sceneparsing.csail.mit.edu\/","`",".","Args",":","transforms","(","list",")",":","A","list","of","image","transformations",".","dataset_root","(","str",",","optional",")",":","The","ADK20K","dataset","directory",".","Default",":","None",".","mode","(","str",",","optional",")",":","A","subset","of","the","entire","dataset",".","It","should","be","one","of","(","'train","'",",","'val","'",")",".","Default",":","'train","'",".","edge","(","bool",",","optional",")",":","Whether","to","compute","edge","while","training",".","Default",":","False"]
code: def __getitem__(self, idx):
      data = {}
      data["trans_info"] = []
      image_path, label_path = self.file_list[idx]
      data["img"] = image_path
      data[
          "gt_fields"
      ] = (
          []
      )  # If key in gt_fields, the data[key] have transforms synchronous.
  
      if self.mode == "val":
          label = np.asarray(Image.open(label_path))
          # The class 0 is ignored. And it will equal to 255 after
          # subtracted 1, because the dtype of label is uint8.
          label = label - 1
          data = self.transforms(data)
          label = label[np.newaxis, :, :]
          data["label"] = label
          return data
      else:
          data["label"] = np.asarray(Image.open(label_path))
          data["gt_fields"].append("label")
          data["label"] = data["label"] - 1
          data = self.transforms(data)
          if self.edge:
              edge_mask = F.mask_to_binary_edge(
                  label, radius=2, num_classes=self.num_classes
              )
              data["edge"] = edge_mask
          return data
  
file_path: PaddleSeg/paddleseg/datasets/ade.py
imports: import os
  import numpy
  from PIL import Image
  from paddleseg.datasets import Dataset
  from paddleseg.utils.download import download_file_and_uncompress
  from paddleseg.utils import seg_env
  from paddleseg.cvlibs import manager
  from paddleseg.transforms import Compose
  import paddleseg.transforms.functional
label_desc: Use image node_id 2 for calling the ADE20K obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: data, data