code: def convert_to_trainID(maskpath, out_mask_dir, is_train):
      mask = np.array(Image.open(maskpath))
      mask_copy = mask.copy()
      for clsID, trID in clsID_to_trID.items():
          mask_copy[mask == clsID] = trID
      seg_filename = (
          osp.join(out_mask_dir, "train2017", osp.basename(maskpath))
          if is_train
          else osp.join(out_mask_dir, "val2017", osp.basename(maskpath))
      )
      Image.fromarray(mask_copy).save(seg_filename, "PNG")
  
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 1 for calling a global function with example usage: convert_to_trainID(maskpath, out_mask_dir, is_train) without return types