code: def main():
      args = parse_args()
      coco_path = args.coco_path
      out_dir = osp.join(coco_path, args.out_dir_name)
      nproc = args.nproc
  
      mkdir_or_exist(osp.join(out_dir, "train2017"))
      mkdir_or_exist(osp.join(out_dir, "val2017"))
  
      train_list = glob(
          osp.join(coco_path, "stuffthingmaps/train2017", "*.png")
      )
      val_list = glob(
          osp.join(coco_path, "stuffthingmaps/val2017", "*.png")
      )
      assert (
          len(train_list) + len(val_list)
      ) == COCO_LEN, "Wrong length of list {} & {}".format(
          len(train_list), len(val_list)
      )
  
      if args.nproc > 1:
          track_parallel_progress(
              partial(
                  convert_to_trainID,
                  out_mask_dir=out_dir,
                  is_train=True,
              ),
              train_list,
              nproc=nproc,
          )
          track_parallel_progress(
              partial(
                  convert_to_trainID,
                  out_mask_dir=out_dir,
                  is_train=False,
              ),
              val_list,
              nproc=nproc,
          )
      else:
          track_progress(
              partial(
                  convert_to_trainID,
                  out_mask_dir=out_dir,
                  is_train=True,
              ),
              train_list,
          )
          track_progress(
              partial(
                  convert_to_trainID,
                  out_mask_dir=out_dir,
                  is_train=False,
              ),
              val_list,
          )
  
      print("Done!")
  
file_path: mmdetection/tools/dataset_converters/coco_stuff164k.py
imports: import argparse
  import os.path
  from functools import partial
  from glob import glob
  import numpy
  from mmengine.utils import mkdir_or_exist, track_parallel_progress, track_progress
  from PIL import Image
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types