code: def get_image_and_label(image_file, label_file, transforms=None):
      """Get image and label in correct format for models from file paths."""
      opencv_image = cv2.imread(str(image_file))
      pil_image = Image.fromarray(
          cv2.cvtColor(opencv_image, cv2.COLOR_BGR2RGB)
      )
      if label_file is not None and label_file.exists():
          img_labels = [
              l.split()
              for l in label_file.open("r").read().strip().splitlines()
          ]
          img_labels = np.array(img_labels, dtype=np.float32)
      else:
          img_labels = np.zeros((0, 5), dtype=np.float32)
  
      # Transform x,y,w,h in yolo format (x, y are of the image center, and coordinates are normalized) to standard
      # x,y,w,h format, where x,y are of the top left corner of the bounding box and coordinates are absolute.
      bboxes = []
      for label in img_labels:
          x, y, w, h = label[1:]
          # Note: probably the normalization loses some accuracy in the coordinates as it truncates the number,
          # leading in some cases to `y - h / 2` or `x - w / 2` to be negative
          bboxes.append(
              np.array(
                  [
                      max((x - w / 2) * pil_image.width, 0),
                      max((y - h / 2) * pil_image.height, 0),
                      w * pil_image.width,
                      h * pil_image.height,
                      label[0],
                  ]
              )
          )
  
      if transforms is not None:
          # Albumentations accepts images as numpy and bboxes in defined format + class at the end
          transformed = transforms(
              image=np.array(pil_image), bboxes=bboxes
          )
          pil_image = Image.fromarray(transformed["image"])
          bboxes = transformed["bboxes"]
  
      return pil_image, bboxes
  
file_path: deepchecks/deepchecks/vision/datasets/detection/coco_utils.py
imports: import os
  import pathlib
  from io import BytesIO
  from pathlib import Path
  from urllib.request import urlopen
  from zipfile import ZipFile
  import cv2
  import numpy
  from PIL import Image
label_desc: Use image node_id 2 for calling a global function with example usage: get_image_and_label(image_file, label_file, transforms) and returns: pil_image,  bboxes