code: def refine_pred():
      image_list, image_dir = get_image_list(
          "detection_out/pseudo_color_prediction"
      )
      for ii in image_list:
          name_pred = "detection_out/pseudo_color_prediction/" + ii
          name_label = (
              "data/IDD_Detection/Annotations/all/" + ii[:-3] + "xml"
          )
          pred = np.array(Image.open(name_pred)).astype(np.float32)
          if not os.path.exists(name_label):
              pred_mask = utils.visualize.get_pseudo_color_map(pred)
              pred_saved_path = "detect_out/pred_refine/" + ii
              mkdir(pred_saved_path)
              pred_mask.save(pred_saved_path)
              continue
  
          dom = xml.dom.minidom.parse(name_label)
          root = dom.documentElement
          objects = root.getElementsByTagName("object")
          for item in objects:
              name = item.getElementsByTagName("name")[0]
              if (
                  name.firstChild.data == "traffic sign"
                  or name.firstChild.data == "traffic light"
              ):
                  print(ii)
                  xmin = int(
                      item.getElementsByTagName("bndbox")[0]
                      .getElementsByTagName("xmin")[0]
                      .firstChild.data
                  )
                  ymin = int(
                      item.getElementsByTagName("bndbox")[0]
                      .getElementsByTagName("ymin")[0]
                      .firstChild.data
                  )
                  xmax = int(
                      item.getElementsByTagName("bndbox")[0]
                      .getElementsByTagName("xmax")[0]
                      .firstChild.data
                  )
                  ymax = int(
                      item.getElementsByTagName("bndbox")[0]
                      .getElementsByTagName("ymax")[0]
                      .firstChild.data
                  )
                  if name.firstChild.data == "traffic sign":
                      pred[ymin:ymax, xmin:xmax] = 18
                  elif name.firstChild.data == "traffic light":
                      pred[ymin:ymax, xmin:xmax] = 19
  
          pred_mask = utils.visualize.get_pseudo_color_map(pred)
          pred_saved_path = "detect_out/pred_refine/" + ii
          mkdir(pred_saved_path)
          pred_mask.save(pred_saved_path)
  
file_path: PaddleSeg/contrib/AutoNUE/tools/IDD_labeling.py
imports: import os
  import numpy
  import cv2
  from PIL import Image
  from paddleseg import utils
  import xml.dom.minidom
label_desc: Use image node_id 3 for calling a global function with example usage: refine_pred() without return types