code: def visualize_semantic(
      semantic, save_path, colormap, image=None, weight=0.5
  ):
      """
      Save semantic segmentation results.
  
      Args:
          semantic(np.ndarray): The result semantic segmenation results, shape is (h, w).
          save_path(str): The save path.
          colormap(np.ndarray): A color map for visualization.
          image(np.ndarray, optional): Origin image to prediction, merge semantic with
              image if provided. Default: None.
          weight(float, optional): The image weight when merge semantic with image. Default: 0.5.
      """
      semantic = semantic.astype("uint8")
      colored_semantic = colormap[semantic]
      if image is not None:
          colored_semantic = cv2.addWeighted(
              image, weight, colored_semantic, 1 - weight, 0
          )
      cv2.imwrite(save_path, colored_semantic)
  
file_path: PaddleSeg/contrib/PanopticDeepLab/utils/visualize.py
imports: import os
  import cv2
  import numpy
  from PIL import Image
label_desc: Use image node_id 3 for calling a global function with example usage: visualize_semantic(semantic, save_path, colormap, image, weight) without return types