code: def compute_overlaps(boxes1, boxes2):
      """Computes IoU overlaps between two sets of boxes.
      boxes1, boxes2: [N, (y1, x1, y2, x2)]. / 3D: (z1, z2))
      For better performance, pass the largest set first and the smaller second.
      """
      # Areas of anchors and GT boxes
      if boxes1.shape[1] == 4:
          area1 = (boxes1[:, 2] - boxes1[:, 0]) * (
              boxes1[:, 3] - boxes1[:, 1]
          )
          area2 = (boxes2[:, 2] - boxes2[:, 0]) * (
              boxes2[:, 3] - boxes2[:, 1]
          )
          # Compute overlaps to generate matrix [boxes1 count, boxes2 count]
          # Each cell contains the IoU value.
          overlaps = np.zeros((boxes1.shape[0], boxes2.shape[0]))
          for i in range(overlaps.shape[1]):
              box2 = boxes2[i]  # this is the gt box
              overlaps[:, i] = compute_iou_2D(
                  box2, boxes1, area2[i], area1
              )
          return overlaps
  
      else:
          # Areas of anchors and GT boxes
          volume1 = (
              (boxes1[:, 2] - boxes1[:, 0])
              * (boxes1[:, 3] - boxes1[:, 1])
              * (boxes1[:, 5] - boxes1[:, 4])
          )
          volume2 = (
              (boxes2[:, 2] - boxes2[:, 0])
              * (boxes2[:, 3] - boxes2[:, 1])
              * (boxes2[:, 5] - boxes2[:, 4])
          )
          # Compute overlaps to generate matrix [boxes1 count, boxes2 count]
          # Each cell contains the IoU value.
          overlaps = np.zeros((boxes1.shape[0], boxes2.shape[0]))
          for i in range(overlaps.shape[1]):
              box2 = boxes2[i]  # this is the gt box
              overlaps[:, i] = compute_iou_3D(
                  box2, boxes1, volume2[i], volume1
              )
          return overlaps
  
imports: import numpy
  import scipy.misc
  import scipy.ndimage
  import torch
  from torch.autograd import Variable
  import torch.nn
label_desc: Use image node_id 3 for calling a global function with example usage: compute_overlaps(boxes1, boxes2) and returns: overlaps, overlaps