From e6a2970746b968683e5a346e60ff095c68bcb16c Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Sun, 19 Dec 2021 11:15:37 +0000 Subject: [PATCH] add eps --- ppocr/metrics/rec_metric.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ppocr/metrics/rec_metric.py b/ppocr/metrics/rec_metric.py index db2f41c3..b0ccd974 100644 --- a/ppocr/metrics/rec_metric.py +++ b/ppocr/metrics/rec_metric.py @@ -48,7 +48,7 @@ class RecMetric(object): self.norm_edit_dis += norm_edit_dis return { 'acc': correct_num / all_num, - 'norm_edit_dis': 1 - norm_edit_dis / all_num + 'norm_edit_dis': 1 - norm_edit_dis / (all_num + 1e-3) } def get_metric(self): @@ -58,8 +58,8 @@ class RecMetric(object): 'norm_edit_dis': 0, } """ - acc = 1.0 * self.correct_num / self.all_num - norm_edit_dis = 1 - self.norm_edit_dis / self.all_num + acc = 1.0 * self.correct_num / (self.all_num + 1e-3) + norm_edit_dis = 1 - self.norm_edit_dis / (self.all_num + 1e-3) self.reset() return {'acc': acc, 'norm_edit_dis': norm_edit_dis} -- GitLab