code: def _generate_colormap(num_colors):
      """
      Finds a unique color map based on the number of colors inputted ideal for semantic segmentation.
      Parameters
      ----------
      num_colors:
          How many unique colors you want
  
      Returns
      -------
      colors:
          colors with num_colors distinct colors
      """
  
      try:
          from matplotlib.cm import hsv
      except:
          raise ImportError('try "pip install matplotlib"')
  
      num_shades = 7
      num_colors_with_shades = -(-num_colors // num_shades) * num_shades
      linear_nums = np.linspace(
          0, 1, num_colors_with_shades, endpoint=False
      )
  
      arr_by_shade_rows = linear_nums.reshape(num_shades, -1)
      arr_by_shade_columns = arr_by_shade_rows.T
      num_partitions = arr_by_shade_columns.shape[0]
      nums_distributed_like_rising_saw = arr_by_shade_columns.flatten()
  
      initial_cm = hsv(nums_distributed_like_rising_saw)
      lower_partitions_half = num_partitions // 2
      upper_partitions_half = num_partitions - lower_partitions_half
  
      lower_half = lower_partitions_half * num_shades
      initial_cm[:lower_half, :3] *= np.linspace(0.2, 1, lower_half)[
          :, np.newaxis
      ]
  
      upper_half_indices = np.arange(
          lower_half, num_colors_with_shades
      ).reshape(upper_partitions_half, num_shades)
      modifier = (
          (1 - initial_cm[upper_half_indices, :3])
          * np.arange(upper_partitions_half)[:, np.newaxis, np.newaxis]
          / upper_partitions_half
      )
      initial_cm[upper_half_indices, :3] += modifier
      colors = initial_cm[:num_colors]
      return colors
  
file_path: cleanlab/cleanlab/segmentation/summary.py
imports: from typing import Any, Dict, List, Optional
  import numpy
  import pandas
  from tqdm import tqdm
  from cleanlab.internal.segmentation_utils import _get_summary_optional_params
label_desc: Use image node_id 4 for calling a global function with example usage: _generate_colormap(num_colors) and returns: colors