traccuracy.matchers._matched

Module Contents

Classes

Matched

Data class storing gt graph, pred graph, computed mapping, and matcher info.

class traccuracy.matchers._matched.Matched(gt_graph: traccuracy._tracking_graph.TrackingGraph, pred_graph: traccuracy._tracking_graph.TrackingGraph, mapping: list[tuple[Any, Any]], matcher_info: dict)[source]

Data class storing gt graph, pred graph, computed mapping, and matcher info.

The computed mapping type (e.g. one-to-one) is computed in the matched object.

Variables:
  • gt_pred_map – A dictionary from gt node to list of matched pred nodes

  • pred_gt_map – A dictionary from pred node to list of matched gt nodes

Parameters:
  • gt_graph (traccuracy.TrackingGraph) – Tracking graph object for the gt

  • pred_graph (traccuracy.TrackingGraph) – Tracking graph object for the pred

  • mapping (list[tuple[Any, Any]]) – List of tuples where each tuple maps a gt node to a pred node

  • matcher_info (dict) – Dictionary containing name and parameters from the matcher that generated the mapping

property matching_type: str

Determines the matching type from gt to pred: one-to-one, one-to-many, many-to-one, many-to-many

get_gt_pred_match(gt_node: collections.abc.Hashable) collections.abc.Hashable | None[source]

Looks for a single pred node matched to a gt node

Assumes the matching is one-to-one

Parameters:

gt_node (Hashable) – ground truth node

Returns:

Predicted node id if there is a match or none

if there is no match

Return type:

Hashable | None

get_pred_gt_match(pred_node: collections.abc.Hashable) collections.abc.Hashable | None[source]

Looks for a single gt node that matches a pred node

Parameters:

pred_node (Hashable) – predicted node id

Returns:

Ground truth node id if there is a match or none

if there is no match

Return type:

Hashable | None

get_gt_pred_matches(gt_node: collections.abc.Hashable) list[collections.abc.Hashable][source]

Look for predicted node matches to a gt node

Parameters:

gt_node (Hashable) – Ground truth node id

Returns:

List of matching predicted nodes

Return type:

list(Hashable)

get_pred_gt_matches(pred_node: collections.abc.Hashable) list[collections.abc.Hashable][source]

Look for gt node matches to a predicted node

Parameters:

pred_node (Hashable) – Predicted node ID

Returns:

List of matching ground truth nodes

Return type:

list(hashable)