discopat.nn_training.evaluation.base
Functions
|
Compute the Average Precision (AP) for a given localization threshold. |
|
Evaluate a model on a data loader. |
- discopat.nn_training.evaluation.base.compute_ap(matching_dict, threshold)[source]
Compute the Average Precision (AP) for a given localization threshold.
- Parameters:
matching_dict (dict[str, dict[str, array]]) –
dictionary in the form: image_id: {
”matching_matrix”: array of shape (N_preds, N_gts), “scores”: array of shape (N_preds,)
}
threshold (float) – localization threshold,
- Returns:
The AP.
- Return type:
float
Note
The predictions and scores should already be sorted by descending score.
- discopat.nn_training.evaluation.base.evaluate(model, data_loader, localization_criterion, device)[source]
Evaluate a model on a data loader.
- Parameters:
model (NeuralNet) – the neural network to be evaluated,
data_loader (DataLoader) – the evaluation dataloader,
localization_criterion (str) – metric used for GT-pred matching,
device (ComputingDevice) – computing device on which the model is stored.
- Returns:
AP50, AP[50:95:05].
- Return type:
A dict containing the name and values of the following metrics