code: def plot_segmentation(seg, ax=None, palette=None, num_objects=None):
      import seaborn as sns  # pylint: disable=import-outside-toplevel
  
      if ax is None:
          _, ax = get_image_plot(seg.shape[1], seg.shape[0])
      if num_objects is None:
          num_objects = np.max(seg)  # assume consecutive numbering
      num_objects += 1  # background
      if palette is None:
          palette = [(0.0, 0.0, 0.0)] + sns.color_palette(
              "hls", num_objects - 1
          )
  
      seg_img = np.zeros(
          (seg.shape[0], seg.shape[1], 3), dtype=np.float32
      )
      for i in range(num_objects):
          seg_img[np.nonzero(seg[:, :, 0] == i)] = palette[i]
      ax.imshow(seg_img, interpolation="nearest")
  
file_path: kubric/kubric/plotting.py
imports: import colorsys
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: plot_segmentation(seg, ax, palette, num_objects) without return types