metrics
sleap.info.metrics
¶
Module for producing prediction metrics for SLEAP datasets.
Functions:
| Name | Description |
|---|---|
calculate_pairwise_cost |
Calculate (a * b) matrix of pairwise costs using cost function. |
compare_instance_lists |
Given two lists of corresponding Instances, returns |
list_points_array |
Given list of Instances, returns (instances * nodes * 2) matrix. |
match_instance_lists |
Sorts two lists of Instances to find best overall correspondence |
match_instance_lists_nodewise |
For each node for each instance in the first list, pairs it with the |
matched_instance_distances |
Distances between ground truth and predicted nodes over a set of frames. |
nodeless_point_dist |
Given two instances, returns array of distances for closest points |
point_dist |
Given two instances, returns array of distances for corresponding nodes. |
point_match_count |
Given an array of distances, returns number which are <= threshold. |
point_nonmatch_count |
Given an array of distances, returns number which are not <= threshold. |
calculate_pairwise_cost(instances_a, instances_b, cost_function)
¶
Calculate (a * b) matrix of pairwise costs using cost function.
Source code in sleap/info/metrics.py
compare_instance_lists(instances_a, instances_b)
¶
Given two lists of corresponding Instances, returns (instances * nodes) matrix of distances between corresponding nodes.
Source code in sleap/info/metrics.py
list_points_array(instances)
¶
Given list of Instances, returns (instances * nodes * 2) matrix.
Source code in sleap/info/metrics.py
match_instance_lists(instances_a, instances_b, cost_function)
¶
Sorts two lists of Instances to find best overall correspondence for a given cost function (e.g., total distance between points).
Source code in sleap/info/metrics.py
match_instance_lists_nodewise(instances_a, instances_b, thresh=5)
¶
For each node for each instance in the first list, pairs it with the closest corresponding node from any instance in the second list.
Source code in sleap/info/metrics.py
matched_instance_distances(labels_gt, labels_pr, match_lists_function=match_instance_lists_nodewise, frame_range=None)
¶
Distances between ground truth and predicted nodes over a set of frames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels_gt
|
Labels
|
the |
required |
labels_pr
|
Labels
|
the |
required |
match_lists_function
|
Callable
|
function for determining corresponding instances Takes two lists of instances and returns "sorted" lists. |
match_instance_lists_nodewise
|
frame_range
|
optional
|
range of frames for which to compare data If None, we compare every frame in labels_gt with corresponding frame in labels_pr. |
None
|
Source code in sleap/info/metrics.py
nodeless_point_dist(inst_a, inst_b)
¶
Given two instances, returns array of distances for closest points ignoring node identities.
Source code in sleap/info/metrics.py
point_dist(inst_a, inst_b)
¶
Given two instances, returns array of distances for corresponding nodes.
Source code in sleap/info/metrics.py
point_match_count(dist_array, thresh=5)
¶
Given an array of distances, returns number which are <= threshold.
point_nonmatch_count(dist_array, thresh=5)
¶
Given an array of distances, returns number which are not <= threshold.