Skip to content
Snippets Groups Projects
Commit 6db9c111 authored by Manon Blanco's avatar Manon Blanco
Browse files

Display metrics as percentages

parent 89d73adf
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ def print_worst_predictions(all_inferences: Dict[str, List[Inference]]): ...@@ -94,7 +94,7 @@ def print_worst_predictions(all_inferences: Dict[str, List[Inference]]):
inference.prediction, inference.prediction,
) )
alignment_str = f'{alignment["query_aligned"]}\n{alignment["matched_aligned"]}\n{alignment["target_aligned"]}' 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(f"\n#### {NB_WORST_PREDICTIONS} worst prediction(s)\n")
print(table) print(table)
...@@ -126,7 +126,14 @@ def eval_nerval( ...@@ -126,7 +126,14 @@ def eval_nerval(
if not (ground_truths and predictions): if not (ground_truths and predictions):
continue continue
scores = evaluate(ground_truths, predictions, threshold) scores = {
key: {
k: round(value * 100, 2) if k in ["P", "R", "F1"] else value
for k, value in values.items()
}
for key, values in evaluate(ground_truths, predictions, threshold).items()
}
print(f"\n##### {split_name}\n") print(f"\n##### {split_name}\n")
print_results(scores) print_results(scores)
......
...@@ -12,55 +12,55 @@ ...@@ -12,55 +12,55 @@
| tag | predicted | matched | Precision | Recall | F1 | Support | | tag | predicted | matched | Precision | Recall | F1 | Support |
|:---------:|:---------:|:-------:|:---------:|:------:|:-----:|:-------:| |:---------:|:---------:|:-------:|:---------:|:------:|:-----:|:-------:|
| Surname | 2 | 2 | 1.0 | 1.0 | 1.0 | 2 | | Surname | 2 | 2 | 100.0 | 100.0 | 100.0 | 2 |
| Patron | 2 | 0 | 0.0 | 0.0 | 0 | 1 | | Patron | 2 | 0 | 0.0 | 0.0 | 0 | 1 |
| Operai | 2 | 2 | 1.0 | 1.0 | 1.0 | 2 | | Operai | 2 | 2 | 100.0 | 100.0 | 100.0 | 2 |
| Louche | 2 | 1 | 0.5 | 0.5 | 0.5 | 2 | | Louche | 2 | 1 | 50.0 | 50.0 | 50.0 | 2 |
| Koala | 2 | 2 | 1.0 | 1.0 | 1.0 | 2 | | Koala | 2 | 2 | 100.0 | 100.0 | 100.0 | 2 |
| Firstname | 2 | 2 | 1.0 | 1.0 | 1.0 | 2 | | Firstname | 2 | 2 | 100.0 | 100.0 | 100.0 | 2 |
| Chalumeau | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Chalumeau | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Batiment | 2 | 2 | 1.0 | 1.0 | 1.0 | 2 | | Batiment | 2 | 2 | 100.0 | 100.0 | 100.0 | 2 |
| All | 15 | 12 | 0.8 | 0.857 | 0.828 | 14 | | All | 15 | 12 | 80.0 | 85.71 | 82.76 | 14 |
##### val ##### val
| tag | predicted | matched | Precision | Recall | F1 | Support | | tag | predicted | matched | Precision | Recall | F1 | Support |
|:---------:|:---------:|:-------:|:---------:|:------:|:----:|:-------:| |:---------:|:---------:|:-------:|:---------:|:------:|:-----:|:-------:|
| Surname | 1 | 0 | 0.0 | 0.0 | 0 | 1 | | Surname | 1 | 0 | 0.0 | 0.0 | 0 | 1 |
| Patron | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Patron | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Operai | 1 | 0 | 0.0 | 0.0 | 0 | 1 | | Operai | 1 | 0 | 0.0 | 0.0 | 0 | 1 |
| Louche | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Louche | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Koala | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Koala | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Firstname | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Firstname | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Chalumeau | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Chalumeau | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Batiment | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Batiment | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| All | 8 | 6 | 0.75 | 0.75 | 0.75 | 8 | | All | 8 | 6 | 75.0 | 75.0 | 75.0 | 8 |
##### test ##### test
| tag | predicted | matched | Precision | Recall | F1 | Support | | tag | predicted | matched | Precision | Recall | F1 | Support |
|:---------:|:---------:|:-------:|:---------:|:------:|:-----:|:-------:| |:---------:|:---------:|:-------:|:---------:|:------:|:-----:|:-------:|
| Surname | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Surname | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Louche | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Louche | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Koala | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Koala | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Firstname | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Firstname | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| Chalumeau | 1 | 0 | 0.0 | 0.0 | 0 | 1 | | Chalumeau | 1 | 0 | 0.0 | 0.0 | 0 | 1 |
| Batiment | 1 | 1 | 1.0 | 1.0 | 1.0 | 1 | | Batiment | 1 | 1 | 100.0 | 100.0 | 100.0 | 1 |
| All | 6 | 5 | 0.833 | 0.833 | 0.833 | 6 | | All | 6 | 5 | 83.33 | 83.33 | 83.33 | 6 |
#### 5 worst prediction(s) #### 5 worst prediction(s)
| Image name | WER | Alignment between ground truth - prediction | | Image name | WER | Alignment between ground truth - prediction |
|:----------------------------------------:|:------:|:---------------------------------------------------------:| |:----------------------------------------:|:-----:|:---------------------------------------------------------:|
| 2c242f5c-e979-43c4-b6f2-a6d4815b651d.png | 0.5 | ⓈA ⒻCharles Ⓑ11 ⓁP ⒸC ⓀF ⓄA Ⓟ14331 | | 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 | | | | Ⓢd ⒻCharles Ⓑ11 ⓁP ⒸC ⓀF Ⓞd Ⓟ14 31 |
| 0dfe8bcd-ed0b-453e-bf19-cc697012296e.png | 0.2667 | ⓈTemplié ⒻMarcelle Ⓑ93 ⓁJ Ⓚch ⓄE dachyle------- | | 0dfe8bcd-ed0b-453e-bf19-cc697012296e.png | 26.67 | ⓈTemplié ⒻMarcelle Ⓑ93 ⓁJ Ⓚch ⓄE dachyle------- |
| | | ||||||||||||||||||||||||.|||||||||||.||.------- | | | | ||||||||||||||||||||||||.|||||||||||.||.------- |
| | | ⓈTemplié ⒻMarcelle Ⓑ93 ⓁS Ⓚch ⓄE dactylo Ⓟ18376 | | | | ⓈTemplié ⒻMarcelle Ⓑ93 ⓁS Ⓚch ⓄE dactylo Ⓟ18376 |
| ffdec445-7f14-4f5f-be44-68d0844d0df1.png | 0.1429 | ⓈNaudin ⒻMarie Ⓑ53 ⓁS ⒸV ⓀBelle mère | | ffdec445-7f14-4f5f-be44-68d0844d0df1.png | 14.29 | ⓈNaudin ⒻMarie Ⓑ53 ⓁS ⒸV ⓀBelle mère |
| | | |||||||||||||||||||||||.|||||||||||| | | | | |||||||||||||||||||||||.|||||||||||| |
| | | Ⓢ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 | | 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 | | | | ⓈBellisson ⒻGeorges Ⓑ91 ⓁP ⒸM ⓀCh ⓄPlombier ⓅPatron?12241 |
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment