(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98)
| 143 | |
| 144 | |
| 145 | def fuse_motion(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98): |
| 146 | if cost_matrix.size == 0: |
| 147 | return cost_matrix |
| 148 | gating_dim = 2 if only_position else 4 |
| 149 | gating_threshold = kalman_filter.chi2inv95[gating_dim] |
| 150 | measurements = np.asarray([det.to_xyah() for det in detections]) |
| 151 | for row, track in enumerate(tracks): |
| 152 | gating_distance = kf.gating_distance( |
| 153 | track.mean, track.covariance, measurements, only_position, metric='maha') |
| 154 | cost_matrix[row, gating_distance > gating_threshold] = np.inf |
| 155 | cost_matrix[row] = lambda_ * cost_matrix[row] + (1 - lambda_) * gating_distance |
| 156 | return cost_matrix |
| 157 | |
| 158 | |
| 159 | def fuse_iou(cost_matrix, tracks, detections): |
nothing calls this directly
no test coverage detected