code: def iou_cost(
      tracks, detections, track_indices=None, detection_indices=None
  ):
      """
      IoU distance metric.
  
      Args:
          tracks (list[Track]): A list of tracks.
          detections (list[Detection]): A list of detections.
          track_indices (Optional[list[int]]): A list of indices to tracks that
              should be matched. Defaults to all `tracks`.
          detection_indices (Optional[list[int]]): A list of indices to detections
              that should be matched. Defaults to all `detections`.
  
      Returns:
          cost_matrix (ndarray): A cost matrix of shape len(track_indices),
              len(detection_indices) where entry (i, j) is
              `1 - iou(tracks[track_indices[i]], detections[detection_indices[j]])`.
      """
      if track_indices is None:
          track_indices = np.arange(len(tracks))
      if detection_indices is None:
          detection_indices = np.arange(len(detections))
  
      cost_matrix = np.zeros(
          (len(track_indices), len(detection_indices))
      )
      for row, track_idx in enumerate(track_indices):
          if tracks[track_idx].time_since_update > 1:
              cost_matrix[row, :] = 1e5
              continue
  
          bbox = tracks[track_idx].to_tlwh()
          candidates = np.asarray(
              [detections[i].tlwh for i in detection_indices]
          )
          cost_matrix[row, :] = 1.0 - iou_1toN(bbox, candidates)
      return cost_matrix
  
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 2 for calling a global function with example usage: iou_cost(tracks, detections, track_indices, detection_indices) and returns: cost_matrix