(dist, thresh=1e16)
| 288 | |
| 289 | |
| 290 | def greedy_assignment(dist, thresh=1e16): |
| 291 | matched_indices = [] |
| 292 | if dist.shape[1] == 0: |
| 293 | return np.array(matched_indices, np.int32).reshape(-1, 2) |
| 294 | for i in range(dist.shape[0]): |
| 295 | j = dist[i].argmin() |
| 296 | if dist[i][j] < thresh: |
| 297 | dist[:, j] = 1e18 |
| 298 | matched_indices.append([i, j]) |
| 299 | return np.array(matched_indices, np.int32).reshape(-1, 2) |