class_docstr: Pass in a custom dataset that conforms to the format.
  
  Args:
      transforms (list): Transforms for image.
      dataset_root (str): The dataset directory.
      num_classes (int): Number of classes.
      mode (str, optional): which part of dataset to use. it is one of ('train', 'val', 'test'). Default: 'train'.
      train_path (str, optional): The train dataset file. When mode is 'train', train_path is necessary.
          The contents of train_path file are as follow:
          image1.jpg ground_truth1.png
          image2.jpg ground_truth2.png
      val_path (str. optional): The evaluation dataset file. When mode is 'val', val_path is necessary.
          The contents is the same as train_path
      test_path (str, optional): The test dataset file. When mode is 'test', test_path is necessary.
          The annotation file is not necessary in test_path file.
      separator (str, optional): The separator of dataset list. Default: ' '.
      edge (bool, optional): Whether to compute edge while training. Default: False
  
      Examples:
  
          import paddleseg.transforms as T
          from paddleseg.datasets import Dataset
  
          transforms = [T.RandomPaddingCrop(crop_size=(512,512)), T.Normalize()]
          dataset_root = 'dataset_root_path'
          train_path = 'train_path'
          num_classes = 2
          dataset = Dataset(transforms = transforms,
                            dataset_root = dataset_root,
                            num_classes = 2,
                            train_path = train_path,
                            mode = 'train')
code: def __getitem__(self, idx):
      data = {}
      data["trans_info"] = []
      image_path, label_path = self.file_list[idx]
      data["img"] = image_path
      data["label"] = label_path
      # If key in gt_fields, the data[key] have transforms synchronous.
      data["gt_fields"] = []
      if self.mode == "val":
          data = self.transforms(data)
          if data["label"].ndim == 2:
              data["label"] = data["label"][np.newaxis, :, :]
  
      else:
          data["gt_fields"].append("label")
          data = self.transforms(data)
          if self.edge:
              edge_mask = F.mask_to_binary_edge(
                  data["label"], radius=2, num_classes=self.num_classes
              )
              data["edge"] = edge_mask
      return data
  
file_path: PaddleSeg/paddleseg/datasets/dataset.py
imports: import os
  import paddle
  import numpy
  from PIL import Image
  from paddleseg.cvlibs import manager
  from paddleseg.transforms import Compose
  import paddleseg.transforms.functional
label_desc: Use image node_id 2 for calling the Dataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: data