MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / linear_assignment

Function linear_assignment

tutorials/transtrack/mot_online/matching.py:39–50  ·  view source on GitHub ↗
(cost_matrix, thresh)

Source from the content-addressed store, hash-verified

37
38
39def linear_assignment(cost_matrix, thresh):
40 if cost_matrix.size == 0:
41 return np.empty((0, 2), dtype=int), tuple(range(cost_matrix.shape[0])), tuple(range(cost_matrix.shape[1]))
42 matches, unmatched_a, unmatched_b = [], [], []
43 cost, x, y = lap.lapjv(cost_matrix, extend_cost=True, cost_limit=thresh)
44 for ix, mx in enumerate(x):
45 if mx >= 0:
46 matches.append([ix, mx])
47 unmatched_a = np.where(x < 0)[0]
48 unmatched_b = np.where(y < 0)[0]
49 matches = np.asarray(matches)
50 return matches, unmatched_a, unmatched_b
51
52
53def ious(atlbrs, btlbrs):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected