swarmsort.assignment module
SwarmSort Assignment Algorithms Module
This module contains assignment algorithms for solving the tracking assignment problem. It includes both Hungarian (optimal) and Greedy (fast) assignment methods, as well as hybrid approaches for different tracking scenarios.
- Functions:
numba_greedy_assignment: Fast greedy assignment algorithm compute_assignment_priorities: Priority computation for assignments hungarian_assignment_wrapper: Wrapper for scipy’s Hungarian algorithm
- swarmsort.assignment.compute_assignment_priorities(cost_matrix, max_distance)[source]
Compute priority scores for greedy assignment.
Lower scores indicate higher priority (better matches should be assigned first).
- swarmsort.assignment.hungarian_assignment_wrapper(cost_matrix, max_distance)[source]
Wrapper for scipy’s Hungarian algorithm with distance thresholding.
- swarmsort.assignment.hybrid_assignment(cost_matrix, max_distance, greedy_threshold=30.0, hungarian_fallback_threshold=100.0)[source]
Hybrid assignment using greedy for obvious matches and Hungarian for remainder.
This function first performs greedy assignment on high-confidence (low-cost) matches, then uses Hungarian algorithm for the remaining ambiguous cases.
- Parameters:
- Return type:
- Returns:
Tuple of (matches, unmatched_detections, unmatched_tracks)
- swarmsort.assignment.numba_greedy_assignment(cost_matrix, max_distance)[source]
Optimized greedy assignment using vectorized operations.
This function performs greedy assignment by iteratively selecting the minimum cost match until all possible matches are made.
- Parameters:
- Returns:
matches: Array of matched pairs [(det_idx, track_idx), …]
unmatched_detections: Array of unmatched detection indices
unmatched_tracks: Array of unmatched track indices
- Return type:
Tuple of (matches, unmatched_detections, unmatched_tracks) where