sportslabkit.matching.simple#
Overview#
A matching function that uses a single metric. |
|
A batch matching function that uses a simple distance metric. |
Classes#
- class sportslabkit.matching.simple.SimpleMatchingFunction(metric: sportslabkit.metrics.BaseCostMatrixMetric = IoUCMM(), gate: float = np.inf)[source]#
Bases:
sportslabkit.matching.base.BaseMatchingFunctionA matching function that uses a single metric.
- Parameters:
metric – A metric. Defaults to IoUCMM.
gate – The gate of the metric, i.e. if the metric is larger than this value, the cost will be set to infinity. Defaults to np.inf.
Note
To implement your own matching function, you can inherit from BaseMatchingFunction and override the
compute_cost_matrix()method.Overview
Methods# compute_cost_matrix(trackers, detections)Calculate the matching cost between trackers and detections.
Members
- compute_cost_matrix(trackers: collections.abc.Sequence[sportslabkit.Tracklet], detections: collections.abc.Sequence[sportslabkit.types.detection.Detection]) numpy.ndarray[source]#
Calculate the matching cost between trackers and detections.
- Parameters:
trackers – A list of trackers.
detections – A list of detections.
- Returns:
A 2D numpy array of matching costs between trackers and detections.
- class sportslabkit.matching.simple.SimpleBatchMatchingFunction[source]#
Bases:
sportslabkit.matching.base_batch.BaseBatchMatchingFunctionA batch matching function that uses a simple distance metric.
This class is a simple implementation of batch matching function where the cost is based on the Euclidean distance between the trackers and detections.
Overview
Methods# compute_cost_matrices(trackers, list_of_detections)Calculate the cost matrix between trackers and detections.
Members
- compute_cost_matrices(trackers: list[sportslabkit.Tracklet], list_of_detections: list[list[sportslabkit.types.detection.Detection]]) list[numpy.ndarray][source]#
Calculate the cost matrix between trackers and detections.
- Parameters:
trackers – A list of trackers.
list_of_detections – A list containing a list of detections for each frame.
- Returns:
A list of 2D numpy arrays where the element at [i, j] in the kth array is the cost between tracker i and detection j in frame 0, detection j-1 and detection j otherwise.