class_docstr: Process and show the image batch and its associated label using matplotlib.
code: def _to_numpy(
      img: Union[np.ndarray, Tensor, Image.Image]
  ) -> np.ndarray:
      out: np.ndarray
      if isinstance(img, np.ndarray):
          out = img
      elif isinstance(img, Image.Image):
          out = np.array(img)
      elif isinstance(img, Tensor):
          out = img.squeeze(0).permute(1, 2, 0).cpu().numpy()
      else:
          raise TypeError(f"Unknown image type. Got: {type(img)}.")
      return out
  
imports: from typing import Any, Callable, Collection, Dict, List, Optional, Sequence, Tuple, Type, Union
  import numpy
  import pandas
  from torch import Tensor
  from torch.utils.data import Dataset
  from flash.core.data.base_viz import BaseVisualization
  from flash.core.data.callback import BaseDataFetcher
  from flash.core.data.data_module import DataModule, DatasetInput
  from flash.core.data.io.input import DataKeys, Input
  from flash.core.data.io.input_transform import INPUT_TRANSFORM_TYPE
  from flash.core.data.utilities.classification import TargetFormatter
  from flash.core.data.utilities.paths import PATH_TYPE
  from flash.core.integrations.labelstudio.input import LabelStudioImageClassificationInput, _parse_labelstudio_arguments
  from flash.core.utilities.imports import _FIFTYONE_AVAILABLE, _MATPLOTLIB_AVAILABLE, _TOPIC_IMAGE_AVAILABLE, Image, requires
  from flash.core.utilities.stages import RunningStage
  from flash.image.classification.input import ImageClassificationCSVInput, ImageClassificationDataFrameInput, ImageClassificationFiftyOneInput, ImageClassificationFilesInput, ImageClassificationFolderInput, ImageClassificationImageInput, ImageClassificationNumpyInput, ImageClassificationTensorInput
  from flash.image.classification.input_transform import ImageClassificationInputTransform
label_desc: Use image node_id 1 for calling the MatplotlibVisualization obj's underlying member method code with example usage: obj._to_numpy(img) and returns: out