code: def __init__(
      self,
      transforms,
      dataset_root,
      mode="train",
      coarse_multiple=1,
      add_val=False,
  ):
      self.dataset_root = dataset_root
      self.transforms = Compose(transforms)
      self.file_list = list()
      mode = mode.lower()
      self.mode = mode
      self.num_classes = 19
      self.ignore_index = 255
      self.coarse_multiple = coarse_multiple
  
      if mode not in ["train", "val", "test"]:
          raise ValueError(
              "mode should be 'train', 'val' or 'test', but got {}.".format(
                  mode
              )
          )
  
      if self.transforms is None:
          raise ValueError("`transforms` is necessary, but it is None.")
  
      img_dir = os.path.join(self.dataset_root, "leftImg8bit")
      label_dir = os.path.join(self.dataset_root, "gtFine")
      if (
          self.dataset_root is None
          or not os.path.isdir(self.dataset_root)
          or not os.path.isdir(img_dir)
          or not os.path.isdir(label_dir)
      ):
          raise ValueError(
              "The dataset is not Found or the folder structure is nonconfoumance."
          )
  
      label_files = sorted(
          glob.glob(
              os.path.join(
                  label_dir, mode, "*", "*_gtFine_labelTrainIds.png"
              )
          )
      )
      img_files = sorted(
          glob.glob(
              os.path.join(img_dir, mode, "*", "*_leftImg8bit.png")
          )
      )
  
      self.file_list = [
          [img_path, label_path]
          for img_path, label_path in zip(img_files, label_files)
      ]
      self.num_files = len(self.file_list)
      self.total_num_files = self.num_files
  
      if mode == "train":
          # whether to add val set in training
          if add_val:
              label_files = sorted(
                  glob.glob(
                      os.path.join(
                          label_dir,
                          "val",
                          "*",
                          "*_gtFine_labelTrainIds.png",
                      )
                  )
              )
              img_files = sorted(
                  glob.glob(
                      os.path.join(
                          img_dir, "val", "*", "*_leftImg8bit.png"
                      )
                  )
              )
              val_file_list = [
                  [img_path, label_path]
                  for img_path, label_path in zip(
                      img_files, label_files
                  )
              ]
              self.file_list.extend(val_file_list)
              self.num_files = len(self.file_list)
  
          # use coarse dataset only in training
          img_dir = os.path.join(
              self.dataset_root,
              "leftImg8bit_trainextra",
              "leftImg8bit",
              "train_extra",
          )
          label_dir = os.path.join(
              self.dataset_root, "convert_autolabelled"
          )
  
          if (
              self.dataset_root is None
              or not os.path.isdir(self.dataset_root)
              or not os.path.isdir(img_dir)
              or not os.path.isdir(label_dir)
          ):
              raise ValueError(
                  "The coarse dataset is not Found or the folder structure is nonconfoumance."
              )
  
          coarse_label_files = sorted(
              glob.glob(
                  os.path.join(label_dir, "*", "*_leftImg8bit.png")
              )
          )
          coarse_img_files = sorted(
              glob.glob(os.path.join(img_dir, "*", "*_leftImg8bit.png"))
          )
          if len(coarse_img_files) != len(coarse_label_files):
              raise ValueError(
                  "The number of images = {} is not equal to the number of labels = {} in Cityscapes Autolabeling dataset.".format(
                      len(coarse_img_files), len(coarse_label_files)
                  )
              )
  
          self.coarse_file_list = [
              [img_path, label_path]
              for img_path, label_path in zip(
                  coarse_img_files, coarse_label_files
              )
          ]
          random.shuffle(self.coarse_file_list)
  
          self.total_num_files = int(
              self.num_files * (1 + coarse_multiple)
          )
  
file_path: PaddleSeg/contrib/CityscapesSOTA/datasets/cityscapes_autolabeling.py
imports: import os
  import glob
  import random
  import paddle
  import numpy
  from PIL import Image
  from paddleseg.cvlibs import manager
  from paddleseg.transforms import Compose
label_desc: Use image node_id 1 to create a new CityscapesAutolabeling object from inherited base classes: paddle.io with example: obj = CityscapesAutolabeling(transforms, dataset_root, mode, coarse_multiple, add_val)