(cost_matrix)
| 23 | |
| 24 | |
| 25 | def linear_assignment(cost_matrix): |
| 26 | try: |
| 27 | import lap |
| 28 | _, x, y = lap.lapjv(cost_matrix, extend_cost=True) |
| 29 | return np.array([[y[i],i] for i in x if i >= 0]) # |
| 30 | except ImportError: |
| 31 | from scipy.optimize import linear_sum_assignment |
| 32 | x, y = linear_sum_assignment(cost_matrix) |
| 33 | return np.array(list(zip(x, y))) |
| 34 | |
| 35 | |
| 36 | def iou_batch(bb_test, bb_gt): |
no outgoing calls
no test coverage detected