callcut.evaluation.IoUMatcher🔗

class callcut.evaluation.IoUMatcher(iou_threshold=0.2)[source]🔗

Match intervals using greedy IoU (Intersection over Union).

This matcher pairs ground truth and predicted intervals based on their overlap. It uses a greedy algorithm that prioritizes high-IoU matches.

Parameters:
iou_thresholdfloat

Minimum IoU required for a valid match. Pairs with IoU below this threshold are not matched. Default is 0.2.

Attributes

iou_threshold

Minimum IoU for a valid match.

Methods

match(ground_truth, predictions)

Match predicted intervals to ground truth using greedy IoU matching.

Notes

The matching algorithm:

  1. Compute IoU for all (ground_truth, prediction) pairs.

  2. Sort pairs by IoU in descending order.

  3. Greedily assign matches, starting with the highest IoU pair.

  4. Each ground truth and prediction can only be matched once.

  5. Pairs with IoU < threshold are not matched.

Examples

>>> from callcut.evaluation import Interval
>>> gt = [Interval(0.0, 1.0), Interval(2.0, 3.0)]
>>> pred = [Interval(0.1, 0.9), Interval(2.1, 3.1)]
>>> matcher = IoUMatcher(iou_threshold=0.2)
>>> matches = matcher.match(gt, pred)
>>> len(matches)
2
match(ground_truth, predictions)[source]🔗

Match predicted intervals to ground truth using greedy IoU matching.

Parameters:
ground_truthlist of Interval

Ground truth call intervals.

predictionslist of Interval

Predicted call intervals.

Returns:
matcheslist of Match

List of matches. Each match contains the indices of matched ground truth and prediction intervals, plus the IoU score.

property iou_threshold🔗

Minimum IoU for a valid match.

Type:

float