From ebf0d5364001366d3f2654c7b628cd09dc907048 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Thu, 8 Aug 2019 17:26:02 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Do=20not=20hardcode=20used=20mod?= =?UTF-8?q?els?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++++++++++ ocrd_calamari/ocrd-tool.json | 2 +- ocrd_calamari/recognize.py | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c5c85cd..f76e932 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,17 @@ This offers a OCR-D compliant workspace processor for some of the functionality This processor only operates on the text line level and so needs a line segmentation (and by extension a binarized image) as its input. + +Example Usage +------------- + +~~~ +ocrd-calamari-recognize -p test-parameters.json -m mets.xml -I OCR-D-SEG-LINE -O OCR-D-OCR-CALAMARI +~~~ + +With `test-parameters.json`: +~~~ +{ + "checkpoint": "/path/to/some/trained/models/*.ckpt.json" +} +~~~ diff --git a/ocrd_calamari/ocrd-tool.json b/ocrd_calamari/ocrd-tool.json index 449c372..5fc5073 100644 --- a/ocrd_calamari/ocrd-tool.json +++ b/ocrd_calamari/ocrd-tool.json @@ -18,7 +18,7 @@ "OCR-D-OCR-CALAMARI" ], "parameters": { - "XXX checkpoint": {"type": "string", "format": "file", "cacheable": true}, + "checkpoint": {"type": "string", "format": "file", "cacheable": true}, "voter": {"type": "string", "default": "confidence_voter_default_ctc"} } } diff --git a/ocrd_calamari/recognize.py b/ocrd_calamari/recognize.py index f6e79f3..ad5f8ad 100644 --- a/ocrd_calamari/recognize.py +++ b/ocrd_calamari/recognize.py @@ -27,7 +27,7 @@ class CalamariRecognize(Processor): def _init_calamari(self): os.environ['TF_CPP_MIN_LOG_LEVEL'] = TF_CPP_MIN_LOG_LEVEL - checkpoints = glob('/home/mike/devel/experiments/train-calamari-gt4histocr/models/*.ckpt.json') # XXX + checkpoints = glob(self.parameter['checkpoint']) self.predictor = MultiPredictor(checkpoints=checkpoints) voter_params = VoterParams()