deeplabcut.core.inferenceutils
Classes:
| Name | Description |
|---|---|
MatchedPrediction |
A match between a prediction and a ground truth assembly. |
Functions:
| Name | Description |
|---|---|
evaluate_assembly_greedy |
Runs greedy mAP evaluation, as done by pycocotools. |
match_assemblies |
Matches assemblies to ground truth predictions. |
MatchedPrediction
dataclass
A match between a prediction and a ground truth assembly.
The ground truth assembly should be None f the prediction was not matched to any GT, and the OKS should be 0.
Attributes:
| Name | Type | Description |
|---|---|---|
prediction |
Assembly
|
A prediction made by a pose model. |
score |
float
|
The confidence score for the prediction. |
ground_truth |
Assembly | None
|
If None, then this prediction is not matched to any ground truth (this can happen when there are more predicted individuals than GT). Otherwise, the ground truth assembly to which this prediction is matched. |
oks |
float
|
The OKS score between the prediction and the ground truth pose. |
Source code in deeplabcut/core/inferenceutils.py
evaluate_assembly_greedy
evaluate_assembly_greedy(
assemblies_gt: dict[Any, list[Assembly]],
assemblies_pred: dict[Any, list[Assembly]],
oks_sigma: float,
oks_thresholds: Iterable[float],
margin: int | float = 0,
symmetric_kpts: list[tuple[int, int]] | None = None,
) -> dict
Runs greedy mAP evaluation, as done by pycocotools.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[Any, list[Assembly]]
|
A dictionary mapping image ID (e.g. filepath) to ground truth
assemblies. Should contain all the same keys as |
required |
|
dict[Any, list[Assembly]]
|
A dictionary mapping image ID (e.g. filepath) to predicted
assemblies. Should contain all the same keys as |
required |
|
float
|
The sigma to use to compute OKS values for keypoints . |
required |
|
Iterable[float]
|
The OKS thresholds at which to compute precision & recall. |
required |
|
int | float
|
The margin to use to compute bounding boxes from keypoints. |
0
|
|
list[tuple[int, int]] | None
|
The symmetric keypoints in the dataset. |
None
|
Source code in deeplabcut/core/inferenceutils.py
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | |
match_assemblies
match_assemblies(
predictions: list[Assembly],
ground_truth: list[Assembly],
sigma: float,
margin: int = 0,
symmetric_kpts: list[tuple[int, int]] | None = None,
greedy_matching: bool = False,
greedy_oks_threshold: float = 0.0,
) -> tuple[int, list[MatchedPrediction]]
Matches assemblies to ground truth predictions.
Returns:
| Name | Type | Description |
|---|---|---|
int |
tuple[int, list[MatchedPrediction]]
|
the total number of valid ground truth assemblies list[MatchedPrediction]: a list containing all valid predictions, potentially matched to ground truth assemblies. |
Source code in deeplabcut/core/inferenceutils.py
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | |