(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98)
| 121 | |
| 122 | |
| 123 | def fuse_motion(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98): |
| 124 | if cost_matrix.size == 0: |
| 125 | return cost_matrix |
| 126 | gating_dim = 2 if only_position else 4 |
| 127 | gating_threshold = kalman_filter.chi2inv95[gating_dim] |
| 128 | measurements = np.asarray([det.to_xyah() for det in detections]) |
| 129 | for row, track in enumerate(tracks): |
| 130 | gating_distance = kf.gating_distance( |
| 131 | track.mean, track.covariance, measurements, only_position, metric='maha') |
| 132 | cost_matrix[row, gating_distance > gating_threshold] = np.inf |
| 133 | cost_matrix[row] = lambda_ * cost_matrix[row] + (1 - lambda_) * gating_distance |
| 134 | return cost_matrix |
| 135 | |
| 136 | |
| 137 | def fuse_iou(cost_matrix, tracks, detections): |
nothing calls this directly
no test coverage detected