code: def visualize_instances(
      imask,
      bg_color=255,
      boundaries_color=None,
      boundaries_width=1,
      boundaries_alpha=0.8,
  ):
      num_objects = imask.max() + 1
      palette = get_palette(num_objects)
      if bg_color is not None:
          palette[0] = bg_color
  
      result = palette[imask].astype(np.uint8)
      if boundaries_color is not None:
          boundaries_mask = get_boundaries(
              imask, boundaries_width=boundaries_width
          )
          tresult = result.astype(np.float32)
          tresult[boundaries_mask] = boundaries_color
          tresult = (
              tresult * boundaries_alpha
              + (1 - boundaries_alpha) * result
          )
          result = tresult.astype(np.uint8)
  
      return result
  
file_path: PaddleSeg/EISeg/eiseg/util/vis.py
imports: from functools import lru_cache
  import cv2
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: visualize_instances(imask, bg_color, boundaries_color, boundaries_width, boundaries_alpha) and returns: result