code: def visualize(
      image: Union[np.ndarray, str],
      result: np.ndarray,
      weight: float = 0.6,
  ) -> np.ndarray:
      """
      Convert segmentation result to color image, and save added image.
  
      Args:
          image (str|np.ndarray): The path of origin image or bgr image.
          result (np.ndarray): The predict result of image.
          weight (float): The image weight of visual image, and the result weight is (1 - weight). Default: 0.6
  
      Returns:
          vis_result (np.ndarray): return the visualized result.
      """
  
      color_map = get_color_map_list(256)
      color_map = [
          color_map[i : i + 3] for i in range(0, len(color_map), 3)
      ]
      color_map = np.array(color_map).astype("uint8")
      # Use OpenCV LUT for color mapping
      c1 = cv2.LUT(result, color_map[:, 0])
      c2 = cv2.LUT(result, color_map[:, 1])
      c3 = cv2.LUT(result, color_map[:, 2])
      pseudo_img = np.dstack((c1, c2, c3))
      if isinstance(image, str):
          im = cv2.imread(image)
      else:
          im = image
      vis_result = cv2.addWeighted(
          im, weight, pseudo_img, 1 - weight, 0
      )
  
      return vis_result
  
imports: import os
  from typing import Callable, Union, List, Tuple
  import cv2
  import paddle
  import PIL
  import numpy
  import paddle.nn.functional
  from scipy.sparse import csr_matrix
label_desc: Use image node_id 10 for calling a global function with example usage: visualize(image, result, weight) and returns: vis_result