code: def to_numpy_array(img) -> np.ndarray:
      if isinstance(img, PIL.Image.Image):
          return np.array(img)
      return to_numpy(img)
  
imports: import os
  from typing import TYPE_CHECKING, List, Tuple, Union
  import numpy
  from packaging import version
  import requests
  from .utils import ExplicitEnum, is_jax_tensor, is_tf_tensor, is_torch_available, is_torch_tensor, is_vision_available, to_numpy
  from .utils.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD
label_desc: Use image node_id 4 for calling a global function with example usage: to_numpy_array(img) and returns: to_numpy, np