code: def compute_iou(box: np.ndarray, boxes: np.ndarray) -> float:
      """Compute the IOU between a selected box and other boxes.
  
      Args:
          box: np.ndarray
              Selected box, shape (4)
          boxes: np.ndarray
              Other boxes used for computing IOU, shape (num_of_boxes, 4).
  
      Returns:
          float: intersection over union
      """
      # Compute xmin, ymin, xmax, ymax for both boxes
      xmin = np.maximum(box[0], boxes[:, 0])
      ymin = np.maximum(box[1], boxes[:, 1])
      xmax = np.minimum(box[2], boxes[:, 2])
      ymax = np.minimum(box[3], boxes[:, 3])
  
      # Compute intersection area
      intersection_area = np.maximum(0, xmax - xmin) * np.maximum(
          0, ymax - ymin
      )
  
      # Compute union area
      box_area = (box[2] - box[0]) * (box[3] - box[1])
      boxes_area = (boxes[:, 2] - boxes[:, 0]) * (
          boxes[:, 3] - boxes[:, 1]
      )
      union_area = box_area + boxes_area - intersection_area
  
      # Compute IoU
      iou = intersection_area / union_area
  
      return iou
  
file_path: sahi/sahi/utils/yolov8onnx.py
imports: from pathlib import Path
  from typing import Optional
  import numpy
  from sahi.utils.yolov8 import download_yolov8n_model
label_desc: Use image node_id 3 for calling a global function with example usage: compute_iou(box, boxes) and returns: iou