code: def bbox_iou(bbox1: torch.Tensor, bbox2: torch.Tensor, device="cpu"):
      """
      Returns the IoU value of overlapping boxes
      """
      b1_x1, b1_y1, b1_x2, b1_y2 = (
          bbox1[:, 0],
          bbox1[:, 1],
          bbox1[:, 2],
          bbox1[:, 3],
      )
      b2_x1, b2_y1, b2_x2, b2_y2 = (
          bbox2[:, 0],
          bbox2[:, 1],
          bbox2[:, 2],
          bbox2[:, 3],
      )
  
      # intersections
      inter_rect_x1 = torch.max(b1_x1, b2_x1)
      inter_rect_y1 = torch.max(b1_y1, b2_y1)
      inter_rect_x2 = torch.min(b1_x2, b2_x2)
      inter_rect_y2 = torch.min(b1_y2, b2_y2)
      inter_area = torch.max(
          inter_rect_x2 - inter_rect_x1 + 1,
          torch.zeros(inter_rect_x2.shape, device=device),
      ) * torch.max(
          inter_rect_y2 - inter_rect_y1 + 1,
          torch.zeros(inter_rect_y2.shape, device=device),
      )
  
      b1_area = (b1_x2 - b1_x1 + 1) * (b1_y2 - b1_y1 + 1)
      b2_area = (b2_x2 - b2_x1 + 1) * (b2_y2 - b2_y1 + 1)
  
      return inter_area / (b1_area + b2_area - inter_area)
  
file_path: ImageAI/imageai/yolov3/utils.py
imports: import math
  from typing import Union, List, Tuple
  import torch
  import numpy
  import cv2
  from torchvision.ops import batched_nms
label_desc: Use image node_id 4 for calling a global function with example usage: bbox_iou(bbox1, bbox2, device) and returns: unknown