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

Function merge_matches

tutorials/ctracker/mot_online/matching.py:22–36  ·  view source on GitHub ↗
(m1, m2, shape)

Source from the content-addressed store, hash-verified

20 9: 16.919}
21
22def merge_matches(m1, m2, shape):
23 O,P,Q = shape
24 m1 = np.asarray(m1)
25 m2 = np.asarray(m2)
26
27 M1 = scipy.sparse.coo_matrix((np.ones(len(m1)), (m1[:, 0], m1[:, 1])), shape=(O, P))
28 M2 = scipy.sparse.coo_matrix((np.ones(len(m2)), (m2[:, 0], m2[:, 1])), shape=(P, Q))
29
30 mask = M1*M2
31 match = mask.nonzero()
32 match = list(zip(match[0], match[1]))
33 unmatched_O = tuple(set(range(O)) - set([i for i, j in match]))
34 unmatched_Q = tuple(set(range(Q)) - set([j for i, j in match]))
35
36 return match, unmatched_O, unmatched_Q
37
38
39def _indices_to_matches(cost_matrix, indices, thresh):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected