From 53e7ce87d35f716f538eba9b9e608402cb03a2ff Mon Sep 17 00:00:00 2001 From: manonBlanco <blanco@teklia.com> Date: Fri, 22 Dec 2023 15:48:07 +0100 Subject: [PATCH] Display metrics as percentages --- dan/ocr/evaluate.py | 2 +- tests/data/evaluate/metrics_table.md | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dan/ocr/evaluate.py b/dan/ocr/evaluate.py index e101832a..f8f1fc74 100644 --- a/dan/ocr/evaluate.py +++ b/dan/ocr/evaluate.py @@ -97,7 +97,7 @@ def print_worst_predictions(all_inferences: Dict[str, List[Inference]]): inference.prediction, ) alignment_str = f'{alignment["query_aligned"]}\n{alignment["matched_aligned"]}\n{alignment["target_aligned"]}' - table.add_row([inference.image, inference.wer, alignment_str]) + table.add_row([inference.image, round(inference.wer * 100, 2), alignment_str]) print(f"\n#### {NB_WORST_PREDICTIONS} worst prediction(s)\n") print(table) diff --git a/tests/data/evaluate/metrics_table.md b/tests/data/evaluate/metrics_table.md index 8e562331..27bf53ad 100644 --- a/tests/data/evaluate/metrics_table.md +++ b/tests/data/evaluate/metrics_table.md @@ -50,17 +50,17 @@ #### 5 worst prediction(s) -| Image name | WER | Alignment between ground truth - prediction | -|:----------------------------------------:|:------:|:---------------------------------------------------------:| -| 2c242f5c-e979-43c4-b6f2-a6d4815b651d.png | 0.5 | ⓈA â’»Charles â’·11 â“P â’¸C â“€F â“„A â“…14331 | -| | | |.||||||||||||||||||||||||.||||.|| | -| | | Ⓢd â’»Charles â’·11 â“P â’¸C â“€F â“„d â“…14 31 | -| 0dfe8bcd-ed0b-453e-bf19-cc697012296e.png | 0.2667 | ⓈTemplié â’»Marcelle â’·93 â“J â“€ch â“„E dachyle------- | -| | | ||||||||||||||||||||||||.|||||||||||.||.------- | -| | | ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376 | -| ffdec445-7f14-4f5f-be44-68d0844d0df1.png | 0.1429 | ⓈNaudin â’»Marie â’·53 â“S â’¸V â“€Belle mère | -| | | |||||||||||||||||||||||.|||||||||||| | -| | | ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère | -| 0a56e8b3-95cd-4fa5-a17b-5b0ff9e6ea84.png | 0.125 | ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…-------12241 | -| | | |||||||||||||||||||||||||||||||||||||||||||||-------||||| | -| | | ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241 | +| Image name | WER | Alignment between ground truth - prediction | +|:----------------------------------------:|:-----:|:---------------------------------------------------------:| +| 2c242f5c-e979-43c4-b6f2-a6d4815b651d.png | 50.0 | ⓈA â’»Charles â’·11 â“P â’¸C â“€F â“„A â“…14331 | +| | | |.||||||||||||||||||||||||.||||.|| | +| | | Ⓢd â’»Charles â’·11 â“P â’¸C â“€F â“„d â“…14 31 | +| 0dfe8bcd-ed0b-453e-bf19-cc697012296e.png | 26.67 | ⓈTemplié â’»Marcelle â’·93 â“J â“€ch â“„E dachyle------- | +| | | ||||||||||||||||||||||||.|||||||||||.||.------- | +| | | ⓈTemplié â’»Marcelle â’·93 â“S â“€ch â“„E dactylo â“…18376 | +| ffdec445-7f14-4f5f-be44-68d0844d0df1.png | 14.29 | ⓈNaudin â’»Marie â’·53 â“S â’¸V â“€Belle mère | +| | | |||||||||||||||||||||||.|||||||||||| | +| | | ⓈNaudin â’»Marie â’·53 â“S â’¸v â“€Belle mère | +| 0a56e8b3-95cd-4fa5-a17b-5b0ff9e6ea84.png | 12.5 | ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…-------12241 | +| | | |||||||||||||||||||||||||||||||||||||||||||||-------||||| | +| | | ⓈBellisson â’»Georges â’·91 â“P â’¸M â“€Ch â“„Plombier â“…Patron?12241 | -- GitLab