diff --git a/mmocr/evaluation/metrics/hmean_iou_metric.py b/mmocr/evaluation/metrics/hmean_iou_metric.py index c5d40971c..d389992e1 100644 --- a/mmocr/evaluation/metrics/hmean_iou_metric.py +++ b/mmocr/evaluation/metrics/hmean_iou_metric.py @@ -70,7 +70,13 @@ def __init__(self, super().__init__(collect_device=collect_device, prefix=prefix) self.match_iou_thr = match_iou_thr self.ignore_precision_thr = ignore_precision_thr - self.pred_score_thrs = np.arange(**pred_score_thrs) + self.pred_score_thrs = np.linspace( + pred_score_thrs['start'], + pred_score_thrs['stop'], + int( + np.round((pred_score_thrs['stop'] - pred_score_thrs['start']) / + pred_score_thrs['step'])) + 1, + endpoint=True) assert strategy in ['max_matching', 'vanilla'] self.strategy = strategy diff --git a/projects/ABCNet/abcnet/metric/e2e_hmean_iou_metric.py b/projects/ABCNet/abcnet/metric/e2e_hmean_iou_metric.py index bdab4375e..22e00eac8 100644 --- a/projects/ABCNet/abcnet/metric/e2e_hmean_iou_metric.py +++ b/projects/ABCNet/abcnet/metric/e2e_hmean_iou_metric.py @@ -75,7 +75,13 @@ def __init__(self, super().__init__(collect_device=collect_device, prefix=prefix) self.match_iou_thr = match_iou_thr self.ignore_precision_thr = ignore_precision_thr - self.pred_score_thrs = np.arange(**pred_score_thrs) + self.pred_score_thrs = np.linspace( + pred_score_thrs['start'], + pred_score_thrs['stop'], + int( + np.round((pred_score_thrs['stop'] - pred_score_thrs['start']) / + pred_score_thrs['step'])) + 1, + endpoint=True) self.word_spotting = word_spotting self.min_length_case_word = min_length_case_word self.special_characters = special_characters diff --git a/projects/SPTS/spts/metric/e2e_point_metric.py b/projects/SPTS/spts/metric/e2e_point_metric.py index d219b4aa6..6aaa6fc8c 100644 --- a/projects/SPTS/spts/metric/e2e_point_metric.py +++ b/projects/SPTS/spts/metric/e2e_point_metric.py @@ -58,7 +58,13 @@ def __init__(self, collect_device: str = 'cpu', prefix: Optional[str] = None) -> None: super().__init__(collect_device=collect_device, prefix=prefix) - self.text_score_thrs = np.arange(**text_score_thrs) + self.text_score_thrs = np.linspace( + text_score_thrs['start'], + text_score_thrs['stop'], + int( + np.round((text_score_thrs['stop'] - text_score_thrs['start']) / + text_score_thrs['step'])) + 1, + endpoint=True) self.word_spotting = word_spotting self.match_dist_thr = match_dist_thr if lexicon_path: