code: def find_matching_box_fast(boxes_list, new_box, match_iou):
      def bb_iou_array(boxes, new_box):
          # bb intersection over union
          xA = np.maximum(boxes[:, 0], new_box[0])
          yA = np.maximum(boxes[:, 1], new_box[1])
          xB = np.minimum(boxes[:, 2], new_box[2])
          yB = np.minimum(boxes[:, 3], new_box[3])
  
          interArea = np.maximum(xB - xA, 0) * np.maximum(yB - yA, 0)
  
          # compute the area of both the prediction and ground-truth rectangles
          boxAArea = (boxes[:, 2] - boxes[:, 0]) * (
              boxes[:, 3] - boxes[:, 1]
          )
          boxBArea = (new_box[2] - new_box[0]) * (
              new_box[3] - new_box[1]
          )
  
          iou = interArea / (boxAArea + boxBArea - interArea)
  
          return iou
  
      if boxes_list.shape[0] == 0:
          return -1, match_iou
  
      boxes = boxes_list
  
      ious = bb_iou_array(boxes[:, 4:], new_box[4:])
  
      ious[boxes[:, 0] != new_box[0]] = -1
  
      best_idx = np.argmax(ious)
      best_iou = ious[best_idx]
  
      if best_iou <= match_iou:
          best_iou = match_iou
          best_idx = -1
  
      return best_idx, best_iou
  
file_path: mmdetection/mmdet/models/utils/wbf.py
imports: import warnings
  from typing import Tuple
  import numpy
  import torch
  from torch import Tensor
label_desc: Use image node_id 4 for calling a global function with example usage: find_matching_box_fast(boxes_list, new_box, match_iou) and returns: best_idx,  best_iou, iou, unknown,  match_iou