code: def linear_assignment(cost_matrix, thresh):
      try:
          import lap
      except Exception as e:
          raise RuntimeError(
              "Unable to use JDE/FairMOT/ByteTrack, please install lap, for example: `pip install lap`, see https://github.com/gatagat/lap"
          )
      if cost_matrix.size == 0:
          return (
              np.empty((0, 2), dtype=int),
              tuple(range(cost_matrix.shape[0])),
              tuple(range(cost_matrix.shape[1])),
          )
      matches, unmatched_a, unmatched_b = [], [], []
      cost, x, y = lap.lapjv(
          cost_matrix, extend_cost=True, cost_limit=thresh
      )
      for ix, mx in enumerate(x):
          if mx >= 0:
              matches.append([ix, mx])
      unmatched_a = np.where(x < 0)[0]
      unmatched_b = np.where(y < 0)[0]
      matches = np.asarray(matches)
      return matches, unmatched_a, unmatched_b
  
file_path: PaddleHub/modules/video/multiple_object_tracking/fairmot_dla34/modeling/mot/matching/jde_matching.py
imports: import scipy
  import numpy
  from scipy.spatial.distance import cdist
  from ..motion import kalman_filter
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: linear_assignment(cost_matrix, thresh) and returns: matches,  unmatched_a,  unmatched_b, np,  tuple,  tuple