code: def generate_list(args):
      dataset_root = args.dataset_root
      separator = args.separator
  
      for dataset_split in args.second_folder:
          print("Creating {}.txt...".format(dataset_split))
          image_files = get_files(0, dataset_split, args)
          label_files = get_files(1, dataset_split, args)
          if not image_files:
              img_dir = os.path.join(
                  dataset_root, args.folder[0], dataset_split
              )
              warnings.warn("No images in {} !!!".format(img_dir))
          num_images = len(image_files)
  
          if not label_files:
              label_dir = os.path.join(
                  dataset_root, args.folder[1], dataset_split
              )
              warnings.warn("No labels in {} !!!".format(label_dir))
          num_label = len(label_files)
  
          if num_images != num_label and num_label > 0:
              raise Exception(
                  "Number of images = {}    number of labels = {} \n"
                  "Either number of images is equal to number of labels, "
                  "or number of labels is equal to 0.\n"
                  "Please check your dataset!".format(
                      num_images, num_label
                  )
              )
  
          file_list = os.path.join(dataset_root, dataset_split + ".txt")
          with open(file_list, "w") as f:
              for item in range(num_images):
                  left = image_files[item].replace(dataset_root, "", 1)
                  if left[0] == os.path.sep:
                      left = left.lstrip(os.path.sep)
  
                  try:
                      right = label_files[item].replace(
                          dataset_root, "", 1
                      )
                      if right[0] == os.path.sep:
                          right = right.lstrip(os.path.sep)
                      line = left + separator + right + "\n"
                  except:
                      line = left + "\n"
  
                  f.write(line)
                  print(line)
  
file_path: PaddleSeg/tools/data/create_dataset_list.py
imports: import glob
  import os.path
  import argparse
  import warnings
label_desc: Use image node_id 4 for calling a global function with example usage: generate_list(args) without return types