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
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
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
212 213 214 215 216 217 218 219 220 221 222 223 | |
list_points_array(instances)
¶
Given list of Instances, returns (instances * nodes * 2) matrix.
Source code in sleap/info/metrics.py
226 227 228 229 230 231 232 233 | |
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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
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
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
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
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
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
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
point_dist(inst_a, inst_b)
¶
Given two instances, returns array of distances for corresponding nodes.
Source code in sleap/info/metrics.py
165 166 167 168 169 170 171 172 173 174 175 176 | |
point_match_count(dist_array, thresh=5)
¶
Given an array of distances, returns number which are <= threshold.
Source code in sleap/info/metrics.py
236 237 238 | |
point_nonmatch_count(dist_array, thresh=5)
¶
Given an array of distances, returns number which are not <= threshold.
Source code in sleap/info/metrics.py
241 242 243 | |