code: def make_dataset(
      split=0, data_root=None, data_list=None, sub_list=None
  ):
      assert split in [0, 1, 2, 3, 10, 11, 999]
      if not os.path.isfile(data_list):
          raise (
              RuntimeError(
                  "Image list file do not exist: " + data_list + "\n"
              )
          )
  
      # Shaban uses these lines to remove small objects:
      # if util.change_coordinates(mask, 32.0, 0.0).sum() > 2:
      #    filtered_item.append(item)
      # which means the mask will be downsampled to 1/32 of the original size and the valid area should be larger than 2,
      # therefore the area in original size should be accordingly larger than 2 * 32 * 32
      image_label_list = []
      list_read = open(data_list).readlines()
      print("Processing data...".format(sub_list))
      sub_class_file_list = {}
      for sub_c in sub_list:
          sub_class_file_list[sub_c] = []
  
      for l_idx in tqdm(range(len(list_read))):
          line = list_read[l_idx]
          line = line.strip()
          line_split = line.split(" ")
          image_name = os.path.join(data_root, line_split[0])
          label_name = os.path.join(data_root, line_split[1])
          item = (image_name, label_name)
          label = cv2.imread(label_name, cv2.IMREAD_GRAYSCALE)
          label_class = np.unique(label).tolist()
  
          if 0 in label_class:
              label_class.remove(0)
          if 255 in label_class:
              label_class.remove(255)
  
          new_label_class = []
          for c in label_class:
              if c in sub_list:
                  tmp_label = np.zeros_like(label)
                  target_pix = np.where(label == c)
                  tmp_label[target_pix[0], target_pix[1]] = 1
                  if tmp_label.sum() >= 2 * 32 * 32:
                      new_label_class.append(c)
  
          label_class = new_label_class
  
          if len(label_class) > 0:
              image_label_list.append(item)
              for c in label_class:
                  if c in sub_list:
                      sub_class_file_list[c].append(item)
  
      print("Checking image&label pair {} list done! ".format(split))
      return image_label_list, sub_class_file_list
  
file_path: pfe-net/util/dataset.py
imports: import os
  import os.path
  import cv2
  import numpy
  from torch.utils.data import Dataset
  import torch.nn.functional
  import torch
  import random
  import time
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: make_dataset(split, data_root, data_list, sub_list) and returns: image_label_list,  sub_class_file_list