MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / gate_cost_matrix

Function gate_cost_matrix

tutorials/ctracker/mot_online/matching.py:174–184  ·  view source on GitHub ↗
(kf, cost_matrix, tracks, detections, only_position=False)

Source from the content-addressed store, hash-verified

172 return track_features, det_features, cost_matrix, cost_matrix_det, cost_matrix_track
173
174def gate_cost_matrix(kf, cost_matrix, tracks, detections, only_position=False):
175 if cost_matrix.size == 0:
176 return cost_matrix
177 gating_dim = 2 if only_position else 4
178 gating_threshold = chi2inv95[gating_dim]
179 measurements = np.asarray([det.to_xyah() for det in detections])
180 for row, track in enumerate(tracks):
181 gating_distance = kf.gating_distance(
182 track.mean, track.covariance, measurements, only_position)
183 cost_matrix[row, gating_distance > gating_threshold] = np.inf
184 return cost_matrix
185
186
187def fuse_motion(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98):

Callers

nothing calls this directly

Calls 2

to_xyahMethod · 0.45
gating_distanceMethod · 0.45

Tested by

no test coverage detected