1
0
Fork 0
mirror of https://github.com/mikegerber/ocrd_calamari.git synced 2025-06-09 19:59:53 +02:00
No description
Find a file
Mike Gerber c0a4dfde66
Merge pull request #90 from OCR-D/tf_disable_interactive_logs
disable tensorflow/keras print-to-stdout with tf_disable_interactive_…
2023-10-12 20:57:32 +02:00
.circleci ✔ CircleCI: Do not test on Python 3.6 anymore (EOL since 2021-12-23) 2023-10-12 20:39:39 +02:00
.idea 🔧 Add PyCharm project files 2019-12-05 12:33:33 +01:00
ocrd_calamari 🐛 Fix recognize.py 2023-10-12 20:49:11 +02:00
test ✔ Do not delete test workspace when DEBUG env variable is set 2023-03-13 19:35:04 +01:00
.coveragerc Only do the coverage on our code 2019-12-03 17:11:09 +01:00
.gitignore fix typos 2020-12-22 16:29:40 +01:00
Dockerfile 🐳 Docker: Run pip3 check for good measure 2020-02-06 14:01:36 +01:00
LICENSE 📄 Update license (Fixes #35) 2020-02-13 16:49:11 +01:00
Makefile ✔️ Move installing deps to Makefile 2022-02-24 16:54:56 +01:00
ocrd-tool.json . 2018-07-26 19:09:07 +02:00
README-DEV.md ✒ README: Use backtick syntax for code block 2023-10-12 20:48:34 +02:00
README.md 🧹 README: Do not mention obsolete + unsupported checkpoint parameter 2022-09-16 11:25:38 +02:00
requirements-test.txt Use GT segmentation to test 2019-12-03 17:11:09 +01:00
requirements.txt 🐛 Fix installation by keeping protobuf < 4.0 2023-04-03 17:28:49 +02:00
setup.py setup.py: read version from ocrd-tool.json 2021-01-28 16:04:34 +01:00

ocrd_calamari

Recognize text using Calamari OCR.

image image image

Introduction

ocrd_calamari offers a OCR-D compliant workspace processor for the functionality of Calamari OCR. It uses OCR-D workspaces (METS) with PAGE XML documents as input and output.

This processor only operates on the text line level and so needs a line segmentation (and by extension a binarized image) as its input.

In addition to the line text it may also output word and glyph segmentation including per-glyph confidence values and per-glyph alternative predictions as provided by the Calamari OCR engine, using a textequiv_level of word or glyph. Note that while Calamari does not provide word segmentation, this processor produces word segmentation inferred from text segmentation and the glyph positions. The provided glyph and word segmentation can be used for text extraction and highlighting, but is probably not useful for further image-based processing.

Example output as viewed in PAGE Viewer

Installation

From PyPI

pip install ocrd_calamari

From Repo

pip install .

Install models

Download models trained on GT4HistOCR data:

make gt4histocr-calamari1
ls gt4histocr-calamari1

Manual download: model.tar.xz

Example Usage

Before using ocrd-calamari-recognize get some example data and model, and prepare the document for OCR:

# Download model and example data
make gt4histocr-calamari1
make actevedef_718448162

# Create binarized images and line segmentation using other OCR-D projects
cd actevedef_718448162
ocrd-olena-binarize -P impl sauvola-ms-split -I OCR-D-IMG -O OCR-D-IMG-BIN
ocrd-tesserocr-segment-region -I OCR-D-IMG-BIN -O OCR-D-SEG-REGION
ocrd-tesserocr-segment-line -I OCR-D-SEG-REGION -O OCR-D-SEG-LINE

Finally recognize the text using ocrd_calamari and the downloaded model:

ocrd-calamari-recognize -P checkpoint_dir "../gt4histocr-calamari1" -I OCR-D-SEG-LINE -O OCR-D-OCR-CALAMARI

You may want to have a look at the ocrd-tool.json descriptions for additional parameters and default values.

Development & Testing

For information regarding development and testing, please see README-DEV.md.