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

Function fuse_motion

tutorials/transtrack/mot_online/matching.py:123–134  ·  view source on GitHub ↗
(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98)

Source from the content-addressed store, hash-verified

121
122
123def 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
137def fuse_iou(cost_matrix, tracks, detections):

Callers

nothing calls this directly

Calls 2

to_xyahMethod · 0.45
gating_distanceMethod · 0.45

Tested by

no test coverage detected