code: def colorize_binary_logits(array, cmap=None):
      """Colorizes binary logits as a segmentation map."""
      num_classes = array.shape[-1]
      if cmap is None:
          if num_classes <= 8:
              cmap = "Set3"
          elif num_classes <= 10:
              cmap = "tab10"
          elif num_classes <= 20:
              cmap = "tab20"
          else:
              cmap = "gist_rainbow"
  
      colormap = get_colormap(cmap, num_classes)
      indices = np.argmax(array, axis=-1)
      return np.take(colormap, indices, axis=0)
  
file_path: nerfies/nerfies/visualization.py
imports: import functools
  from matplotlib import cm
  from matplotlib.colors import LinearSegmentedColormap
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: colorize_binary_logits(array, cmap) and returns: np