Skip to content

Commit

Permalink
PredictionResult: do not store out_to_in_trans (prevents s11n of Samp…
Browse files Browse the repository at this point in the history
…le results)
  • Loading branch information
bertsky committed Nov 12, 2024
1 parent f0139d6 commit 54875f2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions calamari_ocr/ocr/predict/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def __init__(
self.chars = codec.decode(prediction.labels)
self.sentence = self.text_postproc.apply_on_sample(Sample(inputs="", outputs="".join(self.chars))).outputs
self.prediction.sentence = self.sentence
self.out_to_in_trans = out_to_in_trans
self.ground_truth = ground_truth

self.prediction.avg_char_probability = 0
Expand All @@ -97,8 +96,8 @@ def __init__(
for c in p.chars:
c.char = codec.code2char[c.label]

p.global_start = int(self.out_to_in_trans(p.local_start))
p.global_end = int(self.out_to_in_trans(p.local_end))
p.global_start = int(out_to_in_trans(p.local_start))
p.global_end = int(out_to_in_trans(p.local_end))
if len(p.chars) > 0:
self.prediction.avg_char_probability += p.chars[0].probability

Expand Down

0 comments on commit 54875f2

Please sign in to comment.