Evaluation Metrics
- fgvc.core.metrics.binary_segmentation_scores(preds: ndarray, targs: ndarray, reduction: str = 'mean') dict
Compute segmentation scores Balanced Accuracy, Precision, Recall, F1, and IoU.
- Parameters:
preds – Array with predicted values.
targs – Array with target values.
reduction – Whether to aggregate scores using mean, sum, or not aggregate at all.
- Returns:
A dictionary with segmentation scores.
- Return type:
scores
- fgvc.core.metrics.binary_segmentation_tp_fp_fn_tn(preds: ndarray, targs: ndarray, pos_label: int = 1) Tuple[ndarray, ndarray, ndarray, ndarray]
Compute values of confusion matrix for binary segmentation.
- Parameters:
preds – Array [b, (2), h, w] with predicted values.
targs – Array [b, h, w] with target values.
pos_label – Class to report in the binary classification.
- Returns:
tp – Array [b,] with True Positives for each sample.
fp – Array [b,] with False Positives for each sample.
fn – Array [b,] with False Negatives for each sample.
tn – Array [b,] with True Negatives for each sample.
- fgvc.core.metrics.classification_scores(preds: ndarray, targs: ndarray, *, top_k: int | None = 3, return_dict: bool = True) dict | Tuple[float, float, float]
Compute top-1 and top-k accuracy and f1 score.
- Parameters:
preds – Numpy array with predictions.
targs – Numpy array with ground-truth targets.
top_k – Value of k to compute top k accuracy.
return_dict – If True, the method returns dictionary with metrics.
- Returns:
A dictionary or tuple with classification scores.
- Return type:
scores