(dist, thresh=1e16)
| 187 | |
| 188 | |
| 189 | def greedy_assignment(dist, thresh=1e16): |
| 190 | matched_indices = [] |
| 191 | if dist.shape[1] == 0: |
| 192 | return np.array(matched_indices, np.int32).reshape(-1, 2) |
| 193 | for i in range(dist.shape[0]): |
| 194 | j = dist[i].argmin() |
| 195 | if dist[i][j] < thresh: |
| 196 | dist[:, j] = 1e18 |
| 197 | matched_indices.append([i, j]) |
| 198 | return np.array(matched_indices, np.int32).reshape(-1, 2) |