mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-07 19:05:13 +02:00
Make sure that 0 cer and wer are reported
This commit is contained in:
parent
fd6f57a263
commit
c9219cbacd
3 changed files with 23 additions and 8 deletions
|
@ -40,13 +40,13 @@
|
||||||
|
|
||||||
{% if metrics %}
|
{% if metrics %}
|
||||||
<h2>Metrics</h2>
|
<h2>Metrics</h2>
|
||||||
{% if cer %}
|
{% if cer is not none %}
|
||||||
<p>CER: {{ cer|round(4) }}</p>
|
<p>CER: {{ cer|round(4) }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if wer %}
|
{% if wer is not none %}
|
||||||
<p>WER: {{ wer|round(4) }}</p>
|
<p>WER: {{ wer|round(4) }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if fca %}
|
{% if fca is not none %}
|
||||||
<p>FCA: {{ fca|round(4) }}</p>
|
<p>FCA: {{ fca|round(4) }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
{% if metrics %}
|
{% if metrics %}
|
||||||
{% if cer %}"cer": {{ cer|json_float }},{% endif %}
|
{% if cer is not none %}"cer": {{ cer|json_float }},{% endif %}
|
||||||
{% if wer %}"wer": {{ wer|json_float }},{% endif %}
|
{% if wer is not none %}"wer": {{ wer|json_float }},{% endif %}
|
||||||
{% if fca %}"fca": {{ fca|json_float }},{% endif %}
|
{% if fca is not none %}"fca": {{ fca|json_float }},{% endif %}
|
||||||
{% if n_characters %}"n_characters": {{ n_characters }},{% endif %}
|
{% if n_characters is not none %}"n_characters": {{ n_characters }},{% endif %}
|
||||||
{% if n_words %}"n_words": {{ n_words }},{% endif %}
|
{% if n_words is not none %}"n_words": {{ n_words }},{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"gt": "{{ gt }}",
|
"gt": "{{ gt }}",
|
||||||
"ocr": "{{ ocr }}"
|
"ocr": "{{ ocr }}"
|
||||||
|
|
|
@ -58,3 +58,18 @@ def test_cli_json_cer_is_infinity(tmp_path):
|
||||||
j = json.load(jsonf)
|
j = json.load(jsonf)
|
||||||
assert j["cer"] == pytest.approx(float("inf"))
|
assert j["cer"] == pytest.approx(float("inf"))
|
||||||
assert j["fca"] == pytest.approx(-13)
|
assert j["fca"] == pytest.approx(-13)
|
||||||
|
|
||||||
|
|
||||||
|
def test_cli_json_cer_0_in_report(tmp_path):
|
||||||
|
"""Test that the cli/process() yields a loadable JSON report when CER == 0"""
|
||||||
|
|
||||||
|
with working_directory(str(tmp_path)):
|
||||||
|
with open("gt.txt", "w") as gtf:
|
||||||
|
gtf.write("Lorem Ipsum")
|
||||||
|
|
||||||
|
process("gt.txt", "gt.txt", "report", metrics="cer,wer,fca")
|
||||||
|
with open("report.json", "r") as jsonf:
|
||||||
|
j = json.load(jsonf)
|
||||||
|
assert j["cer"] == pytest.approx(0)
|
||||||
|
assert j["wer"] == pytest.approx(0)
|
||||||
|
assert j["fca"] == pytest.approx(1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue