class_docstr: Pass in a custom dataset that conforms to the format.
  
  Args:
      mode (str, optional): which part of dataset to use. it is one of ('train', 'val', 'test'). Default: 'train'.
      transforms (list): Transforms for image.
      dataset_root (str): The dataset directory.
      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
      file_length (int, optional): The number of trainable data in the dataset. Default: None.
      ignore_index (int, optional): The category that needs to be ignored during the training process.
      separator (str, optional): The separator of dataset list.
code: def __init__(
      self,
      mode,
      dataset_root,
      transforms,
      train_path=None,
      val_path=None,
      file_length=None,
      img_channels=3,
      ignore_index=255,
      separator="\t",
  ):
      super(BaseDataset, self).__init__()
      self.mode = mode.lower()
      self.dataset_root = dataset_root
      self.transforms = Compose(transforms)
      self._train_source = train_path
      self._eval_source = val_path
      self._file_length = file_length
      self.ignore_index = ignore_index
      self.separator = separator
      self.img_channels = img_channels
  
      if self.mode not in ["train", "val"]:
          raise ValueError(
              "mode should be 'train', 'val' or 'test', but got {}.".format(
                  self.mode
              )
          )
      self._file_names = self._get_file_names(mode)
  
      if not os.path.exists(dataset_root):
          raise FileNotFoundError(
              "there is not `dataset_root`: {}.".format(dataset_root)
          )
      if self.transforms is None:
          raise ValueError("`transforms` is necessary, but it is None.")
  
      if img_channels not in [1, 3]:
          raise ValueError(
              "`img_channels` should in [1, 3], but got {}".format(
                  img_channels
              )
          )
  
file_path: PaddleSeg/contrib/CrossPseudoSupervision/datasets/basedataset.py
imports: import os
  import paddle
  import numpy
  from paddle.io import Dataset
  from paddleseg.transforms import Compose
label_desc: Use image node_id 1 to create a new BaseDataset object from inherited base classes: Dataset with example: obj = BaseDataset(mode, dataset_root, transforms, train_path, val_path, file_length, img_channels, ignore_index, separator)