code: def overlap_ratio(rect1, rect2):
      """Compute overlap ratio between two rects
  
      Parameters
      ----------
          rect1 : nd.array
              2d array of N x [x,y,w,h]
          rect2 : nd.array
              2d array of N x [x,y,w,h]
  
      Return
      ----------
          IOU
      """
      left = np.maximum(rect1[:, 0], rect2[:, 0])
      right = np.minimum(
          rect1[:, 0] + rect1[:, 2], rect2[:, 0] + rect2[:, 2]
      )
      top = np.maximum(rect1[:, 1], rect2[:, 1])
      bottom = np.minimum(
          rect1[:, 1] + rect1[:, 3], rect2[:, 1] + rect2[:, 3]
      )
  
      intersect = np.maximum(0, right - left) * np.maximum(
          0, bottom - top
      )
      union = (
          rect1[:, 2] * rect1[:, 3]
          + rect2[:, 2] * rect2[:, 3]
          - intersect
      )
      iou = intersect / union
      iou = np.maximum(np.minimum(1, iou), 0)
      return iou
  
file_path: gluon-cv/gluoncv/utils/metrics/tracking.py
imports: import numpy
  from ..filesystem import try_import_colorama
label_desc: Use image node_id 2 for calling a global function with example usage: overlap_ratio(rect1, rect2) and returns: iou