code: def bbox_overlaps(boxes, query_boxes):
      n_ = boxes.shape[0]
      k_ = query_boxes.shape[0]
      overlaps = np.zeros((n_, k_), dtype=np.float)
      for k in range(k_):
          query_box_area = (
              query_boxes[k, 2] - query_boxes[k, 0] + 1
          ) * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
          for n in range(n_):
              iw = (
                  min(boxes[n, 2], query_boxes[k, 2])
                  - max(boxes[n, 0], query_boxes[k, 0])
                  + 1
              )
              if iw > 0:
                  ih = (
                      min(boxes[n, 3], query_boxes[k, 3])
                      - max(boxes[n, 1], query_boxes[k, 1])
                      + 1
                  )
                  if ih > 0:
                      box_area = (boxes[n, 2] - boxes[n, 0] + 1) * (
                          boxes[n, 3] - boxes[n, 1] + 1
                      )
                      all_area = float(
                          box_area + query_box_area - iw * ih
                      )
                      overlaps[n, k] = iw * ih / all_area
      return overlaps
  
imports: from __future__ import absolute_import
  import os
  import tqdm
  import pickle
  import datetime
  import argparse
  import numpy
  from scipy.io import loadmat
label_desc: Use image node_id 1 for calling a global function with example usage: bbox_overlaps(boxes, query_boxes) and returns: overlaps