mirror of
https://github.com/mikegerber/ocrd_calamari.git
synced 2025-06-08 19:29:53 +02:00
Merge branch 'master' of https://github.com/OCR-D/ocrd_calamari
This commit is contained in:
commit
93978633f5
4 changed files with 58 additions and 11 deletions
19
Dockerfile
Normal file
19
Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
FROM ocrd/core:edge
|
||||||
|
MAINTAINER OCR-D
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
ENV PYTHONIOENCODING utf8
|
||||||
|
ENV LC_ALL C.UTF-8
|
||||||
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
COPY Makefile .
|
||||||
|
COPY setup.py .
|
||||||
|
COPY ocrd-tool.json .
|
||||||
|
COPY requirements.txt .
|
||||||
|
COPY ocrd_calamari ocrd_calamari
|
||||||
|
|
||||||
|
RUN make calamari/build
|
||||||
|
RUN pip3 install .
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/ocrd-calamari-recognize"]
|
||||||
|
|
28
Makefile
28
Makefile
|
@ -1,11 +1,39 @@
|
||||||
GIT_CLONE = git clone --depth 1
|
GIT_CLONE = git clone --depth 1
|
||||||
|
|
||||||
|
# Docker tag
|
||||||
|
DOCKER_TAG = ocrd/calamari
|
||||||
|
|
||||||
|
# BEGIN-EVAL makefile-parser --make-help Makefile
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo ""
|
||||||
|
@echo " Targets"
|
||||||
|
@echo ""
|
||||||
|
@echo " calamari git clone calamari"
|
||||||
|
@echo " calamari_models git clone calamari_models"
|
||||||
|
@echo " calamari/build Install calamari"
|
||||||
|
@echo " docker Build docker image"
|
||||||
|
@echo ""
|
||||||
|
@echo " Variables"
|
||||||
|
@echo ""
|
||||||
|
@echo " DOCKER_TAG Docker tag"
|
||||||
|
|
||||||
|
# END-EVAL
|
||||||
|
|
||||||
|
# git clone calamari
|
||||||
calamari:
|
calamari:
|
||||||
$(GIT_CLONE) https://github.com/chwick/calamari
|
$(GIT_CLONE) https://github.com/chwick/calamari
|
||||||
|
|
||||||
|
# git clone calamari_models
|
||||||
calamari_models:
|
calamari_models:
|
||||||
$(GIT_CLONE) https://github.com/chwick/calamari_models
|
$(GIT_CLONE) https://github.com/chwick/calamari_models
|
||||||
|
|
||||||
|
# Install calamari
|
||||||
calamari/build: calamari calamari_models
|
calamari/build: calamari calamari_models
|
||||||
cd calamari &&\
|
cd calamari &&\
|
||||||
pip install -r requirements.txt ;\
|
pip install -r requirements.txt ;\
|
||||||
python setup.py install
|
python setup.py install
|
||||||
|
|
||||||
|
# Build docker image
|
||||||
|
docker:
|
||||||
|
docker build -t '$(DOCKER_TAG)' .
|
||||||
|
|
15
README.md
15
README.md
|
@ -2,27 +2,26 @@
|
||||||
|
|
||||||
Recognize text using [Calamari OCR](https://github.com/Calamari-OCR/calamari).
|
Recognize text using [Calamari OCR](https://github.com/Calamari-OCR/calamari).
|
||||||
|
|
||||||
Introduction
|
## Introduction
|
||||||
-------------
|
|
||||||
|
|
||||||
This offers a OCR-D compliant workspace processor for some of the functionality of Calamari OCR.
|
This offers a OCR-D compliant workspace processor for some of the functionality of Calamari OCR.
|
||||||
|
|
||||||
This processor only operates on the text line level and so needs a line segmentation (and by extension a binarized
|
This processor only operates on the text line level and so needs a line segmentation (and by extension a binarized
|
||||||
image) as its input.
|
image) as its input.
|
||||||
|
|
||||||
Example Usage
|
## Example Usage
|
||||||
-------------
|
|
||||||
|
|
||||||
~~~
|
```sh
|
||||||
ocrd-calamari-recognize -p test-parameters.json -m mets.xml -I OCR-D-SEG-LINE -O OCR-D-OCR-CALAMARI
|
ocrd-calamari-recognize -p test-parameters.json -m mets.xml -I OCR-D-SEG-LINE -O OCR-D-OCR-CALAMARI
|
||||||
~~~
|
```
|
||||||
|
|
||||||
With `test-parameters.json`:
|
With `test-parameters.json`:
|
||||||
~~~
|
|
||||||
|
```json
|
||||||
{
|
{
|
||||||
"checkpoint": "/path/to/some/trained/models/*.ckpt.json"
|
"checkpoint": "/path/to/some/trained/models/*.ckpt.json"
|
||||||
}
|
}
|
||||||
~~~
|
```
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
----
|
----
|
||||||
|
|
7
setup.py
7
setup.py
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import codecs
|
from pathlib import Path
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
@ -7,13 +7,14 @@ setup(
|
||||||
name='ocrd_calamari',
|
name='ocrd_calamari',
|
||||||
version='0.0.1',
|
version='0.0.1',
|
||||||
description='Calamari bindings',
|
description='Calamari bindings',
|
||||||
long_description=codecs.open('README.md', encoding='utf-8').read(),
|
long_description=Path('README.md').read_text(),
|
||||||
|
long_description_content_type='text/markdown',
|
||||||
author='Konstantin Baierer, Mike Gerber',
|
author='Konstantin Baierer, Mike Gerber',
|
||||||
author_email='unixprog@gmail.com, mike.gerber@sbb.spk-berlin.de',
|
author_email='unixprog@gmail.com, mike.gerber@sbb.spk-berlin.de',
|
||||||
url='https://github.com/kba/ocrd_calamari',
|
url='https://github.com/kba/ocrd_calamari',
|
||||||
license='Apache License 2.0',
|
license='Apache License 2.0',
|
||||||
packages=find_packages(exclude=('tests', 'docs')),
|
packages=find_packages(exclude=('tests', 'docs')),
|
||||||
install_requires=open('requirements.txt').read().split('\n'),
|
install_requires=Path('requirements.txt').read_text().split('\n'),
|
||||||
package_data={
|
package_data={
|
||||||
'': ['*.json', '*.yml', '*.yaml'],
|
'': ['*.json', '*.yml', '*.yaml'],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue