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

Function linear_assignment

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

Source from the content-addressed store, hash-verified

48
49
50def linear_assignment(cost_matrix, thresh):
51 if cost_matrix.size == 0:
52 return np.empty((0, 2), dtype=int), tuple(range(cost_matrix.shape[0])), tuple(range(cost_matrix.shape[1]))
53 matches, unmatched_a, unmatched_b = [], [], []
54 cost, x, y = lap.lapjv(cost_matrix, extend_cost=True, cost_limit=thresh)
55 for ix, mx in enumerate(x):
56 if mx >= 0:
57 matches.append([ix, mx])
58 unmatched_a = np.where(x < 0)[0]
59 unmatched_b = np.where(y < 0)[0]
60 matches = np.asarray(matches)
61 return matches, unmatched_a, unmatched_b
62
63
64def ious(atlbrs, btlbrs):

Callers 1

stepMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected