code: def load_image(img: Union[str, np.ndarray]) -> Tuple[np.ndarray, str]:
      """
      Load image from path, url, base64 or numpy array.
      Args:
          img: a path, url, base64 or numpy array.
      Returns:
          image (numpy array): the loaded image in BGR format
          image name (str): image name itself
      """
  
      # The image is already a numpy array
      if isinstance(img, np.ndarray):
          return img, "numpy array"
  
      if isinstance(img, Path):
          img = str(img)
  
      if not isinstance(img, str):
          raise ValueError(
              f"img must be numpy array or str but it is {type(img)}"
          )
  
      # The image is a base64 string
      if img.startswith("data:image/"):
          return loadBase64Img(img), "base64 encoded string"
  
      # The image is a url
      if img.startswith("http"):
          return (
              np.array(
                  Image.open(
                      requests.get(img, stream=True, timeout=60).raw
                  ).convert("BGR")
              ),
              # return url as image name
              img,
          )
  
      # The image is a path
      if os.path.isfile(img) is not True:
          raise ValueError(f"Confirm that {img} exists")
  
      # image must be a file on the system then
  
      # image name must have english characters
      if img.isascii() is False:
          raise ValueError(
              f"Input image must not have non-english characters - {img}"
          )
  
      img_obj_bgr = cv2.imread(img)
      # img_obj_rgb = cv2.cvtColor(img_obj_bgr, cv2.COLOR_BGR2RGB)
      return img_obj_bgr, img
  
file_path: deepface/deepface/commons/functions.py
imports: import os
  from typing import Union, Tuple
  import base64
  from pathlib import Path
  from PIL import Image
  import requests
  import numpy
  import cv2
  import tensorflow
  from deprecated import deprecated
  from deepface.detectors import FaceDetector
  from deepface.commons.logger import Logger
label_desc: Use image node_id 4 for calling a global function with example usage: load_image(img) and returns: img_obj_bgr,  img, img,  str, loadBase64Img,  str, np,  img