(cost_matrix, thresh)
| 37 | |
| 38 | |
| 39 | def 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 | |
| 53 | def ious(atlbrs, btlbrs): |
nothing calls this directly
no outgoing calls
no test coverage detected