class_docstr: The PSSL dataset for segmentation. PSSL is short for Pseudo Semantic Segmentation Labels, where the pseudo label
  is computed by the Consensus explanation algorithm.
  
  The PSSL refers to "Distilling Ensemble of Explanations for Weakly-Supervised Pre-Training of Image Segmentation 
  Models" (https://arxiv.org/abs/2207.03335). 
  
  The Consensus explanation refers to "Cross-Model Consensus of Explanations and Beyond for Image Classification 
  Models: An Empirical Study" (https://arxiv.org/abs/2109.00707).
  
  To use this dataset, we need to additionally prepare the orignal ImageNet dataset, which has the folder structure
  as follows:
  
      imagenet_root
      |
      |--train
      |  |--n01440764
      |  |  |--n01440764_10026.JPEG
      |  |  |--...
      |  |--nxxxxxxxx
      |  |--...
  
  where only the "train" set is needed.
  
  The PSSL dataset has the folder structure as follows:
  
      pssl_root
      |
      |--train
      |  |--n01440764
      |  |  |--n01440764_10026.JPEG_eiseg.npz
      |  |  |--...
      |  |--nxxxxxxxx
      |  |--...
      |
      |--imagenet_lsvrc_2015_synsets.txt
      |--train.txt
  
  where "train.txt" and "imagenet_lsvrc_2015_synsets.txt" are included in the PSSL dataset.
  
  Args:
      transforms (list): Transforms for image.
      imagenet_root (str): The path to the original ImageNet dataset.
      pssl_root (str): The path to the PSSL dataset.
      mode (str, optional): Which part of dataset to use. it is one of ('train', 'val', 'test'). Default: 'train'.
      edge (bool, optional): Whether to compute edge while training. Default: False.
code: def __init__(
      self,
      transforms,
      imagenet_root,
      pssl_root,
      mode="train",
      edge=False,
  ):
      mode = mode.lower()
      if mode not in ["train"]:
          raise ValueError(
              "mode should be 'train', but got {}.".format(mode)
          )
      if transforms is None:
          raise ValueError("`transforms` is necessary, but it is None.")
  
      self.transforms = Compose(transforms)
      self.mode = mode
      self.edge = edge
  
      self.num_classes = self.NUM_CLASSES
      self.ignore_index = self.IGNORE_INDEX  # 1001
      self.file_list = []
      self.class_id_dict = {}
  
      if imagenet_root is None or not os.path.isdir(pssl_root):
          raise ValueError(
              "The dataset is not Found or the folder structure is nonconfoumance."
          )
  
      train_list_file = os.path.join(pssl_root, "train.txt")
      if not os.path.exists(train_list_file):
          raise ValueError("Train list file isn't exists.")
      for idx, line in enumerate(open(train_list_file)):
          # line: train/n04118776/n04118776_45912.JPEG_eiseg.npz
          label_path = line.strip()
          img_path = label_path.split(".JPEG")[0] + ".JPEG"
          label_path = os.path.join(pssl_root, label_path)
          img_path = os.path.join(imagenet_root, img_path)
          self.file_list.append([img_path, label_path])
  
      # mapping class name to class id.
      class_id_file = os.path.join(
          pssl_root, "imagenet_lsvrc_2015_synsets.txt"
      )
      if not os.path.exists(class_id_file):
          raise ValueError("Class id file isn't exists.")
      for idx, line in enumerate(open(class_id_file)):
          class_name = line.strip()
          self.class_id_dict[class_name] = idx
  
file_path: PaddleSeg/paddleseg/datasets/pssl.py
imports: import os
  import numpy
  from paddleseg.datasets import Dataset
  from paddleseg.cvlibs import manager
  from paddleseg.transforms import Compose
label_desc: Use image node_id 1 to create a new PSSLDataset object from inherited base classes: Dataset with example: obj = PSSLDataset(transforms, imagenet_root, pssl_root, mode, edge)