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 __init__(
      self, transforms, dataset_root=None, mode="train", edge=False
  ):
      self.dataset_root = dataset_root
      self.transforms = Compose(transforms)
      mode = mode.lower()
      self.mode = mode
      self.file_list = list()
      self.num_classes = self.NUM_CLASSES
      self.ignore_index = self.IGNORE_INDEX
      self.edge = edge
  
      if mode not in ["train", "val"]:
          raise ValueError(
              "`mode` should be one of ('train', 'val') in ADE20K dataset, but got {}.".format(
                  mode
              )
          )
  
      if self.transforms is None:
          raise ValueError("`transforms` is necessary, but it is None.")
  
      if self.dataset_root is None:
          self.dataset_root = download_file_and_uncompress(
              url=URL,
              savepath=seg_env.DATA_HOME,
              extrapath=seg_env.DATA_HOME,
              extraname="ADEChallengeData2016",
          )
      elif not os.path.exists(self.dataset_root):
          self.dataset_root = os.path.normpath(self.dataset_root)
          savepath, extraname = self.dataset_root.rsplit(
              sep=os.path.sep, maxsplit=1
          )
          self.dataset_root = download_file_and_uncompress(
              url=URL,
              savepath=savepath,
              extrapath=savepath,
              extraname=extraname,
          )
  
      if mode == "train":
          img_dir = os.path.join(self.dataset_root, "images/training")
          label_dir = os.path.join(
              self.dataset_root, "annotations/training"
          )
      elif mode == "val":
          img_dir = os.path.join(self.dataset_root, "images/validation")
          label_dir = os.path.join(
              self.dataset_root, "annotations/validation"
          )
      img_files = os.listdir(img_dir)
      label_files = [i.replace(".jpg", ".png") for i in img_files]
      for i in range(len(img_files)):
          img_path = os.path.join(img_dir, img_files[i])
          label_path = os.path.join(label_dir, label_files[i])
          self.file_list.append([img_path, label_path])
  
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 1 to create a new ADE20K object from inherited base classes: Dataset with example: obj = ADE20K(transforms, dataset_root, mode, edge)