code: def display_issues(
      issues: np.ndarray,
      *,
      labels: Optional[np.ndarray] = None,
      pred_probs: Optional[np.ndarray] = None,
      class_names: Optional[List[str]] = None,
      exclude: Optional[List[int]] = None,
      top: Optional[int] = None,
  ) -> None:
      """
      Display semantic segmentation label issues, showing images with problematic pixels highlighted.
  
      Can also show given and predicted masks for each image identified to have label issue.
  
      Parameters
      ----------
      issues:
        Boolean **mask** for the entire dataset
        where ``True`` represents a pixel label issue and ``False`` represents an example that is
        accurately labeled.
  
        Same format as output by :py:func:`segmentation.filter.find_label_issues <cleanlab.segmentation.filter.find_label_issues>`
        or :py:func:`segmentation.rank.issues_from_scores <cleanlab.segmentation.rank.issues_from_scores>`.
  
      labels:
        Optional discrete array of noisy labels for a segmantic segmentation dataset, in the shape ``(N,H,W,)``,
        where each pixel must be integer in 0, 1, ..., K-1.
        If `labels` is provided, this function also displays given label of the pixel identified with issue.
        Refer to documentation for this argument in :py:func:`find_label_issues <cleanlab.segmentation.filter.find_label_issues>` for more information.
  
      pred_probs:
        Optional array of shape ``(N,K,H,W,)`` of model-predicted class probabilities.
        If `pred_probs` is provided, this function also displays predicted label of the pixel identified with issue.
        Refer to documentation for this argument in :py:func:`find_label_issues <cleanlab.segmentation.filter.find_label_issues>` for more information.
  
        Tip
        ---
        If your labels are one hot encoded you can `np.argmax(labels_one_hot, axis=1)` assuming that `labels_one_hot` is of dimension (N,K,H,W)
        before entering in the function
  
      class_names:
        Optional list of strings, where each string represents the name of a class in the semantic segmentation problem.
        The order of the names should correspond to the numerical order of the classes. The list length should be
        equal to the number of unique classes present in the labels.
        If provided, this function will generate a legend
        showing the color mapping of each class in the provided colormap.
  
        Example:
        If there are three classes in your labels, represented by 0, 1, 2, then class_names might look like this:
  
        .. code-block:: python
  
              class_names = ['background', 'person', 'dog']
  
      top:
          Optional maximum number of issues to be printed. If not provided, a good default is used.
  
      exclude:
          Optional list of label classes that can be ignored in the errors, each element must be 0, 1, ..., K-1
  
      """
      class_names, exclude, top = _get_summary_optional_params(
          class_names, exclude, top
      )
      if labels is None and len(exclude) > 0:
          raise ValueError("Provide labels to allow class exclusion")
  
      top = min(top, len(issues))
  
      correct_ordering = np.argsort(-np.sum(issues, axis=(1, 2)))[:top]
  
      try:
          import matplotlib.pyplot as plt
          import matplotlib.patches as mpatches
          from matplotlib.colors import ListedColormap
      except:
          raise ImportError('try "pip install matplotlib"')
  
      output_plots = (pred_probs is not None) + (labels is not None) + 1
  
      # Colormap for errors
      error_cmap = ListedColormap(["none", "red"])
      _, h, w = issues.shape
      if output_plots > 1:
          if pred_probs is not None:
              _, num_classes, _, _ = pred_probs.shape
              cmap = _generate_colormap(num_classes)
          elif labels is not None:
              num_classes = max(np.unique(labels)) + 1
              cmap = _generate_colormap(num_classes)
      else:
          cmap = None
  
      # Show a legend
      if class_names is not None and cmap is not None:
          patches = [
              mpatches.Patch(color=cmap[i], label=class_names[i])
              for i in range(len(class_names))
          ]
          legend = plt.figure()  # adjust figsize for larger legend
          legend.legend(
              handles=patches,
              loc="center",
              ncol=len(class_names),
              facecolor="white",
              fontsize=20,
          )  # adjust fontsize for larger text
          plt.axis("off")
          plt.show()
  
      for i in correct_ordering:
          # Show images
          fig, axes = plt.subplots(
              1, output_plots, figsize=(5 * output_plots, 5)
          )
          plot_index = 0
  
          # First image - Given truth labels
          if labels is not None:
              axes[plot_index].imshow(cmap[labels[i]])
              axes[plot_index].set_title("Given Labels")
              plot_index += 1
  
          # Second image - Argmaxed pred_probs
          if pred_probs is not None:
              axes[plot_index].imshow(
                  cmap[np.argmax(pred_probs[i], axis=0)]
              )
              axes[plot_index].set_title(
                  "Argmaxed Prediction Probabilities"
              )
              plot_index += 1
  
          # Third image - Errors
          if output_plots == 1:
              ax = axes
          else:
              ax = axes[plot_index]
  
          mask = np.full((h, w), True)
          if labels is not None and len(exclude) != 0:
              mask = ~np.isin(labels[i], exclude)
          ax.imshow(issues[i] & mask, cmap=error_cmap, vmin=0, vmax=1)
          ax.set_title(f"Image {i}: Suggested Errors (in Red)")
          plt.show()
  
      return None
  
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 1 for calling a global function with example usage: display_issues(issues) and returns: None