class_docstr: Process and show the image batch and its associated label using matplotlib.
code: def _show_images_and_labels(
      self,
      data: List[Any],
      num_samples: int,
      title: str,
      limit_nb_samples: int = None,
      figsize: Tuple[int, int] = (6.4, 4.8),
  ):
      num_samples = max(1, min(num_samples, limit_nb_samples))
  
      # define the image grid
      cols: int = min(num_samples, self.max_cols)
      rows: int = num_samples // cols
  
      # create figure and set title
      fig, axs = plt.subplots(rows, cols, figsize=figsize)
      fig.suptitle(title)
  
      if not isinstance(axs, np.ndarray):
          axs = np.array(axs)
      axs = axs.flatten()
  
      for i, ax in enumerate(axs):
          # unpack images and labels
          sample = data[i]
          if isinstance(sample, dict):
              image = sample[DataKeys.INPUT]
              label = sample[DataKeys.TARGET]
          elif isinstance(sample, tuple):
              image = sample[0]
              label = sample[1]
          else:
              raise TypeError(f"Unknown data type. Got: {type(data)}.")
          # convert images and labels to numpy and stack horizontally
          image_vis: np.ndarray = self._to_numpy(image)
          label_tmp: Tensor = SegmentationLabelsOutput.labels_to_image(
              torch.as_tensor(label).squeeze(), self.labels_map
          )
          label_vis: np.ndarray = self._to_numpy(label_tmp)
          img_vis = np.hstack((image_vis, label_vis))
          # send to visualiser
          ax.imshow(img_vis)
          ax.axis("off")
      plt.show(block=self.block_viz_window)
  
file_path: lightning-flash/src/flash/image/segmentation/viz.py
imports: from typing import Any, Dict, List, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  from flash.core.data.base_viz import BaseVisualization
  from flash.core.data.io.input import DataKeys
  from flash.core.utilities.imports import _MATPLOTLIB_AVAILABLE, Image, requires
  from flash.core.utilities.stages import RunningStage
  from flash.image.segmentation.output import SegmentationLabelsOutput
label_desc: Use image node_id 3 for calling the SegmentationMatplotlibVisualization obj's underlying member method code with example usage: obj._show_images_and_labels(data, num_samples, title, limit_nb_samples, figsize) without return types