Evaluation

Evaluation module.

Used to compare predictions and groundtruth.

Examples

python -m biom3d.eval -p MyPred -l MyMasks --num_classes 2
python -m biom3d.eval -p MyPred -l MyMasks -f IoU --num_classes 2

Or in python

print(eval("./MyPred","./MyMasks",2))
print(eval("./MyPred","./MyMasks",2,iou))
biom3d.eval.eval(path_lab: str, path_out: str, num_classes: int, fct: ~typing.Callable = <function dice>) tuple[list[float], float][source]

Evaluate segmentation results by comparing predictions to labels using a given metric.

Parameters:
  • path_lab (str) – Path to the folder containing label images.

  • path_out (str) – Path to the folder containing predicted images.

  • num_classes (int) – Number of classes for evaluation.

  • fct (Callable, optional) – Metric function to compute (default is dice).

Returns:

  • results (list of float) – List of metric results per image.

  • mean (float) – Average of results

biom3d.eval.robust_sort(str_list: list[str]) list[str][source]

Perform a robust sorting of a list of strings, useful for sorting file paths.

The sorting pads strings with zeros at the beginning so that all have the same length, then sorts lexicographically, and finally removes the padding.

Parameters:

str_list (list of str) – List of strings to sort.

Returns:

The sorted list of strings.

Return type:

list of str