code: def _convert_bbox(
      bbox: Sequence[Union[int, float]],
      notation_tokens: List[str],
      image_width: Union[int, float, None] = None,
      image_height: Union[int, float, None] = None,
  ) -> np.ndarray:
      assert (image_width is not None and image_height is not None) or (
          image_width is None and image_height is None
      )
  
      data = dict(zip(notation_tokens, bbox))
  
      if "xcenter" in data and "ycenter" in data:
          if image_width is not None and image_height is not None:
              xcenter, ycenter = (
                  data["xcenter"] * image_width,
                  data["ycenter"] * image_height,
              )
          else:
              xcenter, ycenter = data["xcenter"], data["ycenter"]
          return np.asarray(
              [
                  data["label"],
                  xcenter - (data["width"] / 2),
                  ycenter - (data["height"] / 2),
                  data["width"],
                  data["height"],
              ]
          )
  
      elif "height" in data and "width" in data:
          if image_width is not None and image_height is not None:
              xmin, ymin = (
                  data["xmin"] * image_width,
                  data["ymin"] * image_height,
              )
          else:
              xmin, ymin = data["xmin"], data["ymin"]
          return np.asarray(
              [
                  data["label"],
                  xmin,
                  ymin,
                  data["width"],
                  data["height"],
              ]
          )
  
      else:
          if image_width is not None and image_height is not None:
              xmin, ymin = (
                  data["xmin"] * image_width,
                  data["ymin"] * image_height,
              )
              xmax, ymax = (
                  data["xmax"] * image_width,
                  data["ymax"] * image_height,
              )
          else:
              xmin, ymin = data["xmin"], data["ymin"]
              xmax, ymax = data["xmax"], data["ymax"]
          return np.asarray(
              [
                  data["label"],
                  xmin,
                  ymin,
                  xmax - xmin,
                  ymax - ymin,
              ]
          )
  
file_path: deepchecks/deepchecks/vision/utils/detection_formatters.py
imports: from collections import Counter
  from typing import Iterable, List, Sequence, Tuple, Union
  import numpy
  from PIL.Image import Image
  from deepchecks.vision.vision_data.utils import is_torch_object
label_desc: Use image node_id 4 for calling a global function with example usage: _convert_bbox(bbox, notation_tokens, image_width, image_height) and returns: np, np, np