discopat.nn_training.evaluation.matching

Functions

compute_center_distance_matrix(groundtruths, ...)

Compute pairwise Euclidean distance between box centers.

compute_iomean_matrix(groundtruths, predictions)

Compute IoMean matrix between predicted and GT boxes (both [N, 4] arrays in xyxy format).

compute_iou_matrix(groundtruths, predictions)

Compute IoU matrix between predicted and GT boxes (both [N, 4] arrays in xyxy format).

match_groundtruths_and_predictions(...)

Match GTs and predictions on an image in the dataset.

to_np_array(list_or_tensor)

Cast to numpy array.

discopat.nn_training.evaluation.matching.compute_center_distance_matrix(groundtruths, predictions)[source]

Compute pairwise Euclidean distance between box centers.

Parameters:
  • groundtruths (array) – (N_gt, 4)

  • predictions (array) – (N_pred, 4)

Returns:

(N_pred, N_gt) matrix of pairwise center distances.

Return type:

array

discopat.nn_training.evaluation.matching.compute_iomean_matrix(groundtruths, predictions)[source]

Compute IoMean matrix between predicted and GT boxes (both [N, 4] arrays in xyxy format).

Parameters:
  • groundtruths (array) – (N_gt, 4)

  • predictions (array) – (N_pred, 4)

Returns:

(N_pred, N_gt) matrix of pairwise IoUs

Return type:

array

discopat.nn_training.evaluation.matching.compute_iou_matrix(groundtruths, predictions)[source]

Compute IoU matrix between predicted and GT boxes (both [N, 4] arrays in xyxy format).

Parameters:
  • groundtruths (array) – (N_gt, 4)

  • predictions (array) – (N_pred, 4)

Returns:

(N_pred, N_gt) matrix of pairwise IoUs

Return type:

array

discopat.nn_training.evaluation.matching.match_groundtruths_and_predictions(groundtruths, predictions, scores, localization_criterion)[source]

Match GTs and predictions on an image in the dataset.

Parameters:
  • groundtruths (list) – list of groundtruths, boxes [x1, y1, x2, y2],

  • predictions (list) – list of predictions, boxes [x1, y1, x2, y2],

  • scores (list) – list of confidence score, same length as predictions

  • localization_criterion (str) – metric used to assess the fit between GTs and predictions.

Returns:

  • The total number of groundtruths,

  • For each pred, a tuple (score, is_tp).

Return type:

A report for the considered image, containing

discopat.nn_training.evaluation.matching.to_np_array(list_or_tensor)[source]

Cast to numpy array.

Parameters:

list_or_tensor (Array)

Return type:

array