mirror of
https://github.com/mikegerber/ocrd_calamari.git
synced 2025-06-09 19:59:53 +02:00
✅ Add test to check if we warn when processing a "raw"/RGB image with a single-channel model
This commit is contained in:
parent
f20eb3ba45
commit
377466a71a
1 changed files with 14 additions and 0 deletions
|
@ -4,6 +4,7 @@ import subprocess
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import logging
|
||||||
from ocrd.resolver import Resolver
|
from ocrd.resolver import Resolver
|
||||||
|
|
||||||
from ocrd_calamari import CalamariRecognize
|
from ocrd_calamari import CalamariRecognize
|
||||||
|
@ -61,3 +62,16 @@ def test_recognize(workspace):
|
||||||
assert os.path.exists(page1)
|
assert os.path.exists(page1)
|
||||||
with open(page1, 'r', encoding='utf-8') as f:
|
with open(page1, 'r', encoding='utf-8') as f:
|
||||||
assert 'verſchuldeten' in f.read()
|
assert 'verſchuldeten' in f.read()
|
||||||
|
|
||||||
|
|
||||||
|
def test_recognize_should_warn_if_given_rgb_image_and_single_channel_model(workspace, caplog):
|
||||||
|
caplog.set_level(logging.WARNING)
|
||||||
|
CalamariRecognize(
|
||||||
|
workspace,
|
||||||
|
input_file_grp="OCR-D-GT-SEG-LINE",
|
||||||
|
output_file_grp="OCR-D-OCR-CALAMARI-BROKEN",
|
||||||
|
parameter={'checkpoint': CHECKPOINT}
|
||||||
|
).process()
|
||||||
|
|
||||||
|
interesting_log_messages = [t[2] for t in caplog.record_tuples if "Using raw image" in t[2]]
|
||||||
|
assert len(interesting_log_messages) > 10 # For every line!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue