From e34998d58f5e81851139b0ae098d3bede1b19632 Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Tue, 20 Aug 2019 15:36:24 +0200 Subject: [PATCH] :memo: readme, makefile, synopsis for cli Conflicts: Makefile README.md requirements.txt --- Makefile | 48 -------------------------------------------- README.md | 32 ++++++++++++++++++++++++----- ocrd_calamari/cli.py | 3 +++ 3 files changed, 30 insertions(+), 53 deletions(-) diff --git a/Makefile b/Makefile index 9fabd2e..fb51f3e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,3 @@ -# '$(PYTHON)' -PYTHON = python - # '$(PIP_INSTALL)' PIP_INSTALL = pip install @@ -17,16 +14,9 @@ help: @echo " calamari Clone calamari repo" @echo " calamari_models Clone calamari_models repo" @echo " calamari/build pip install calamari" - @echo " deps-test Install testing python deps via pip" - @echo " repo/assets Clone OCR-D/assets to ./repo/assets" - @echo " test/assets Setup test assets" - @echo " assets-clean Remove symlinks in test/assets" - @echo " test Run unit tests" - @echo " coverage Run unit tests and determine test coverage" @echo "" @echo " Variables" @echo "" - @echo " PYTHON '$(PYTHON)'" @echo " PIP_INSTALL '$(PIP_INSTALL)'" @echo " GIT_CLONE '$(GIT_CLONE)'" @@ -50,41 +40,3 @@ calamari_models: # pip install calamari calamari/build: calamari calamari_models cd calamari && $(PIP_INSTALL) . - -# -# Assets and Tests -# - -# Install testing python deps via pip -deps-test: - $(PIP) install -r requirements_test.txt - - -# Clone OCR-D/assets to ./repo/assets -repo/assets: - mkdir -p $(dir $@) - git clone https://github.com/OCR-D/assets "$@" - - -# Setup test assets -test/assets: repo/assets - mkdir -p $@ - cp -r -t $@ repo/assets/data/* - -# Remove symlinks in test/assets -assets-clean: - rm -rf test/assets - -# Run unit tests -test: test/assets calamari_models - # declare -p HTTP_PROXY - $(PYTHON) -m pytest --continue-on-collection-errors test $(PYTEST_ARGS) - -# Run unit tests and determine test coverage -coverage: test/assets calamari_models - coverage erase - make test PYTHON="coverage run" - coverage report - coverage html - -.PHONY: assets-clean test diff --git a/README.md b/README.md index dca1ffc..388b81f 100644 --- a/README.md +++ b/README.md @@ -13,19 +13,41 @@ 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 +## Installation + +### From PyPI + +:construction: :construction: :construction: :construction: :construction: :construction: :construction: + +``` +pip install ocrd_calamari +``` + +### From Repo ```sh -ocrd-calamari-recognize -p test-parameters.json -m mets.xml -I OCR-D-SEG-LINE -O OCR-D-OCR-CALAMARI +pip install . ``` -With `test-parameters.json`: +To install the calamari with the GPU version of Tensorflow: -```json +```sh +pip install 'calamari-ocr[tf_cpu]' +pip install . +``` + +## 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" } -``` +~~~ TODO ---- diff --git a/ocrd_calamari/cli.py b/ocrd_calamari/cli.py index 2a1e210..068b065 100644 --- a/ocrd_calamari/cli.py +++ b/ocrd_calamari/cli.py @@ -7,4 +7,7 @@ from ocrd_calamari.recognize import CalamariRecognize @click.command() @ocrd_cli_options def ocrd_calamari_recognize(*args, **kwargs): + """ + Run Calamari OCR multi-model recognition and voting + """ return ocrd_cli_wrap_processor(CalamariRecognize, *args, **kwargs)