sportslabkit.matching.motion_visual#
Overview#
A matching function that uses a combination of motion and visual |
Classes#
- class sportslabkit.matching.motion_visual.MotionVisualMatchingFunction(motion_metric: sportslabkit.metrics.BaseCostMatrixMetric = IoUCMM(), beta: float = 0.5, motion_metric_gate: float = np.inf, visual_metric: sportslabkit.metrics.BaseCostMatrixMetric = CosineCMM(), visual_metric_gate: float = np.inf)[source]#
Bases:
sportslabkit.matching.base.BaseMatchingFunctionA matching function that uses a combination of motion and visual metrics.
- Parameters:
motion_metric – A motion metric. Defaults to IoUCMM.
beta – The weight of the motion metric. The weight of the visual metric is calculated as 1 - beta. Defaults to 0.5.
motion_metric_gate – The gate of the motion metric, i.e. if the motion metric is larger than this value, the cost will be set to infinity. Defaults to np.inf.
visual_metric – A visual metric. Defaults to CosineCMM.
visual_metric_gate – The gate of the visual metric, i.e. if the visual 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
Attributes# -
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.