code: def main(args):
      dataset_root = args.dataset_root
      label_dir = os.path.join(
          dataset_root, "refinement_final", "train_extra"
      )
      if (
          dataset_root is None
          or not os.path.isdir(dataset_root)
          or not os.path.isdir(label_dir)
      ):
          raise ValueError(
              "The dataset is not Found or the folder structure is nonconfoumance."
          )
  
      autolabeling_label_files = sorted(
          glob.glob(os.path.join(label_dir, "*", "*_leftImg8bit.png"))
      )
      print("start converting...")
      color_map = get_color_map_list(255)
      count = 0
      for file in autolabeling_label_files:
          mask = np.array(Image.open(file))
          for k, v in cl.label2trainid.items():
              binary_mask = mask == k
              mask[binary_mask] = v
          new_mask = Image.fromarray(mask.astype(np.uint8)).convert("P")
          new_mask.putpalette(color_map)
          file_split = file.split(os.sep)
          path = os.path.join(
              dataset_root, "convert_autolabelled", file_split[-2]
          )
          if not os.path.exists(path):
              os.makedirs(path)
          new_mask.save(os.path.join(path, file_split[-1]))
          count += 1
          if count % 10 == 0:
              print("processed {} images".format(count))
  
file_path: PaddleSeg/contrib/CityscapesSOTA/tools/convert_cityscapes_autolabeling.py
imports: import os
  import glob
  import argparse
  import numpy
  from PIL import Image
  import cityscapes_labels
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types