code: def plot_feature_outlier_image(
      od_preds: Dict,
      X: np.ndarray,
      X_recon: np.ndarray = None,
      instance_ids: list = None,
      max_instances: int = 5,
      outliers_only: bool = False,
      n_channels: int = 3,
      figsize: tuple = (20, 20),
  ) -> None:
      """
      Plot feature (pixel) wise outlier scores for images.
  
      Parameters
      ----------
      od_preds
          Output of an outlier detector's prediction.
      X
          Batch of instances to apply outlier detection to.
      X_recon
          Reconstructed instances of X.
      instance_ids
          List with indices of instances to display.
      max_instances
          Maximum number of instances to display.
      outliers_only
          Whether to only show outliers or not.
      n_channels
          Number of channels of the images.
      figsize
          Tuple for the figure size.
      """
      scores = od_preds["data"]["feature_score"]
      if outliers_only and instance_ids is None:
          instance_ids = list(
              np.where(od_preds["data"]["is_outlier"])[0]
          )
      elif instance_ids is None:
          instance_ids = list(
              range(len(od_preds["data"]["is_outlier"]))
          )
      n_instances = min(max_instances, len(instance_ids))
      instance_ids = instance_ids[:n_instances]
  
      if outliers_only and n_instances == 0:
          warnings.warn("No outliers found!", UserWarning)
          return
  
      n_cols = 2
  
      if n_channels == 3:
          n_cols += 2
  
      if X_recon is not None:
          n_cols += 1
  
      fig, axes = plt.subplots(
          nrows=n_instances, ncols=n_cols, figsize=figsize
      )
  
      n_subplot = 1
      for i in range(n_instances):
          idx = instance_ids[i]
  
          X_outlier = X[idx]
          plt.subplot(n_instances, n_cols, n_subplot)
          plt.axis("off")
          if i == 0:
              plt.title("Original")
          plt.imshow(X_outlier)
          n_subplot += 1
  
          if X_recon is not None:
              plt.subplot(n_instances, n_cols, n_subplot)
              plt.axis("off")
              if i == 0:
                  plt.title("Reconstruction")
              plt.imshow(X_recon[idx])
              n_subplot += 1
  
          plt.subplot(n_instances, n_cols, n_subplot)
          plt.axis("off")
          if i == 0:
              plt.title("Outlier Score Channel 0")
          plt.imshow(scores[idx][:, :, 0])
          n_subplot += 1
  
          if n_channels == 3:
              plt.subplot(n_instances, n_cols, n_subplot)
              plt.axis("off")
              if i == 0:
                  plt.title("Outlier Score Channel 1")
              plt.imshow(scores[idx][:, :, 1])
              n_subplot += 1
  
              plt.subplot(n_instances, n_cols, n_subplot)
              plt.axis("off")
              if i == 0:
                  plt.title("Outlier Score Channel 2")
              plt.imshow(scores[idx][:, :, 2])
              n_subplot += 1
  
      plt.show()
  
file_path: alibi-detect/alibi_detect/utils/visualize.py
imports: import matplotlib.pyplot
  import numpy
  import pandas
  from sklearn.metrics import roc_curve, auc
  from typing import Dict, Union
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: plot_feature_outlier_image(od_preds, X, X_recon, instance_ids, max_instances, outliers_only, n_channels, figsize) without return types