code: def box3d_iou(corners1, corners2):
      """Compute 3D bounding box IoU.
  
      Input:
          corners1: numpy array (8,3), assume up direction is negative Y
          corners2: numpy array (8,3), assume up direction is negative Y
      Output:
          iou: 3D bounding box IoU
          iou_2d: bird's eye view 2D bounding box IoU
  
      """
      # corner points are in counter clockwise order
      rect1 = [
          (corners1[i, 0], corners1[i, 1]) for i in range(3, -1, -1)
      ]
      rect2 = [
          (corners2[i, 0], corners2[i, 1]) for i in range(3, -1, -1)
      ]
      area1 = poly_area(np.array(rect1)[:, 0], np.array(rect1)[:, 1])
      area2 = poly_area(np.array(rect2)[:, 0], np.array(rect2)[:, 1])
      inter, inter_area = convex_hull_intersection(rect1, rect2)
      iou_2d = inter_area / (area1 + area2 - inter_area)
      ymax = min(corners1[:, 2].max(), corners2[:, 2].max())
      ymin = max(corners1[:, 2].min(), corners2[:, 2].min())
      inter_vol = inter_area * max(0.0, ymax - ymin)
      vol1 = box3d_vol(corners1)
      vol2 = box3d_vol(corners2)
      iou = inter_vol / (vol1 + vol2 - inter_vol)
      return iou
  
file_path: ARKitScenes/threedod/benchmark_scripts/utils/box_utils.py
imports: import numpy
  import scipy.spatial
  from .rotation import rotate_points_along_z
label_desc: Use image node_id 11 for calling a global function with example usage: box3d_iou(corners1, corners2) and returns: iou