summaryrefslogtreecommitdiff
path: root/text_recognizer/models/metrics.py
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-07-30 23:51:59 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-07-30 23:51:59 +0200
commit04876c35a1eeea68794745f1ca113754c0d97757 (patch)
treeb4664a71c031a9ced6f60c9e72632bad817f11df /text_recognizer/models/metrics.py
parent7268035fb9e57342612a8cc50a1fe04e8841ca2f (diff)
black reformatting
Diffstat (limited to 'text_recognizer/models/metrics.py')
-rw-r--r--text_recognizer/models/metrics.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/text_recognizer/models/metrics.py b/text_recognizer/models/metrics.py
index 9793157..0eb42dc 100644
--- a/text_recognizer/models/metrics.py
+++ b/text_recognizer/models/metrics.py
@@ -26,7 +26,9 @@ class CharacterErrorRate(Metric):
bsz = preds.shape[0]
for index in range(bsz):
pred = [p for p in preds[index].tolist() if p not in self.ignore_indices]
- target = [t for t in targets[index].tolist() if t not in self.ignore_indices]
+ target = [
+ t for t in targets[index].tolist() if t not in self.ignore_indices
+ ]
distance = editdistance.distance(pred, target)
error = distance / max(len(pred), len(target))
self.error += error