diff --git a/src/mednet/libs/segmentation/engine/evaluator.py b/src/mednet/libs/segmentation/engine/evaluator.py index 5e6ae0e503c158a8a7793b5eb7359a9efda3f21e..027e876f0c1ce52e753ba274ca81c771fcb116f8 100644 --- a/src/mednet/libs/segmentation/engine/evaluator.py +++ b/src/mednet/libs/segmentation/engine/evaluator.py @@ -646,6 +646,11 @@ def run( recall_curve = tpr_curve = numpy.array([recall(*k) for k in counts]) precision_curve = numpy.array([precision(*k) for k in counts]) + # correction when precision is very small + precision_curve[ + numpy.logical_and(precision_curve < 1e-8, recall_curve < 1e-8) + ] = 1.0 + # populates data to be recorded in JSON format eval_json_data.setdefault(split_name, {})["counts"] = { k: v for k, v in zip(threshold_list, counts)