code: def iou_1toN(bbox, candidates):
      """
      Computer intersection over union (IoU) by one box to N candidates.
  
      Args:
          bbox (ndarray): A bounding box in format `(top left x, top left y, width, height)`.
              candidates (ndarray): A matrix of candidate bounding boxes (one per row) in the
              same format as `bbox`.
  
      Returns:
          ious (ndarray): The intersection over union in [0, 1] between the `bbox`
              and each candidate. A higher score means a larger fraction of the
              `bbox` is occluded by the candidate.
      """
      bbox_tl = bbox[:2]
      bbox_br = bbox[:2] + bbox[2:]
      candidates_tl = candidates[:, :2]
      candidates_br = candidates[:, :2] + candidates[:, 2:]
  
      tl = np.c_[
          np.maximum(bbox_tl[0], candidates_tl[:, 0])[:, np.newaxis],
          np.maximum(bbox_tl[1], candidates_tl[:, 1])[:, np.newaxis],
      ]
      br = np.c_[
          np.minimum(bbox_br[0], candidates_br[:, 0])[:, np.newaxis],
          np.minimum(bbox_br[1], candidates_br[:, 1])[:, np.newaxis],
      ]
      wh = np.maximum(0.0, br - tl)
  
      area_intersection = wh.prod(axis=1)
      area_bbox = bbox[2:].prod()
      area_candidates = candidates[:, 2:].prod(axis=1)
      ious = area_intersection / (
          area_bbox + area_candidates - area_intersection
      )
      return ious
  
file_path: PaddleHub/modules/video/multiple_object_tracking/fairmot_dla34/modeling/mot/matching/deepsort_matching.py
imports: import numpy
  from scipy.optimize import linear_sum_assignment
  from ..motion import kalman_filter
label_desc: Use image node_id 1 for calling a global function with example usage: iou_1toN(bbox, candidates) and returns: ious