traccuracy.matchers._iou

Module Contents

Classes

IOUMatcher

Constructs a mapping between gt and pred nodes using the IoU of the segmentations

Functions

match_iou(→ list[tuple[collections.abc.Hashable, ...)

Identifies pairs of cells between gt and pred that have iou > threshold

traccuracy.matchers._iou.match_iou(gt: traccuracy._tracking_graph.TrackingGraph, pred: traccuracy._tracking_graph.TrackingGraph, threshold: float = 0.6, one_to_one: bool = False) list[tuple[collections.abc.Hashable, collections.abc.Hashable]][source]

Identifies pairs of cells between gt and pred that have iou > threshold

This can return more than one match for any node Assumes that within a frame, each object has a unique segmentation label and that the label is recorded on each node using label_key

Parameters:
  • gt (traccuracy.TrackingGraph) – Tracking data object containing graph and segmentations

  • pred (traccuracy.TrackingGraph) – Tracking data object containing graph and segmentations

  • threshold (float, optional) – Minimum IoU for matching cells. Defaults to 0.6.

  • one_to_one (optional, bool) – If True, forces the mapping to be one-to-one by running linear assignment on the thresholded iou array. Default False.

Returns:

list of tuples where each tuple contains a gt node and pred node

Return type:

list[(gt_node, pred_node)]

Raises:
  • ValueError – gt and pred must be a TrackingData object

  • ValueError – GT and pred segmentations must be the same shape

class traccuracy.matchers._iou.IOUMatcher(iou_threshold: float = 0.6, one_to_one: bool = False)[source]

Constructs a mapping between gt and pred nodes using the IoU of the segmentations

Lower values for iou_threshold will be more permissive of imperfect matches

Parameters:
  • iou_threshold (float, optional) – Minimum IoU value to assign a match. Defaults to 0.6.

  • one_to_one (optional, bool) – If True, forces the mapping to be one-to-one by running linear assignment on the thresholded iou array. Default False.

property info: dict[str, Any]

Dictionary of Matcher name and any parameters

compute_mapping(gt_graph: traccuracy._tracking_graph.TrackingGraph, pred_graph: traccuracy._tracking_graph.TrackingGraph) traccuracy.matchers._matched.Matched

Run the matching on a given set of gt and pred TrackingGraph and returns a Matched object with a new copy of each TrackingGraph

Parameters:
Returns:

Matched data object

Return type:

matched (traccuracy.matchers.Matched)

Raises:

ValueError – gt and pred must be a TrackingGraph object