code: def imfrombytes(
      content, flag="color", channel_order="bgr", backend=None
  ):
      """Read an image from bytes.
  
      Args:
          content (bytes): Image bytes got from files or other streams.
          flag (str): Same as :func:`imread`.
          backend (str | None): The image decoding backend type. Options are
              `cv2`, `pillow`, `turbojpeg`, `None`. If backend is None, the
              global imread_backend specified by ``mmcv.use_backend()`` will be
              used. Default: None.
  
      Returns:
          ndarray: Loaded image array.
      """
  
      if backend is None:
          backend = imread_backend
      if backend not in supported_backends:
          raise ValueError(
              f"backend: {backend} is not supported. Supported "
              "backends are 'cv2', 'turbojpeg', 'pillow'"
          )
      if backend == "turbojpeg":
          img = jpeg.decode(content, _jpegflag(flag, channel_order))
          if img.shape[-1] == 1:
              img = img[:, :, 0]
          return img
      elif backend == "pillow":
          buff = io.BytesIO(content)
          img = Image.open(buff)
          img = _pillow2array(img, flag, channel_order)
          return img
      else:
          img_np = np.frombuffer(content, np.uint8)
          flag = imread_flags[flag] if is_str(flag) else flag
          img = cv2.imdecode(img_np, flag)
          if flag == IMREAD_COLOR and channel_order == "rgb":
              cv2.cvtColor(img, cv2.COLOR_BGR2RGB, img)
          return img
  
file_path: lavis/lavis/common/annotator/uniformer/mmcv/image/io.py
imports: import io
  import os.path
  from pathlib import Path
  import cv2
  import numpy
  from cv2 import IMREAD_COLOR, IMREAD_GRAYSCALE, IMREAD_IGNORE_ORIENTATION, IMREAD_UNCHANGED
  from annotator.uniformer.mmcv.utils import check_file_exist, is_str, mkdir_or_exist
label_desc: Use image node_id 5 for calling a global function with example usage: imfrombytes(content, flag, channel_order, backend) and returns: img, img, img