Go to file
2021-02-24 15:17:42 +01:00
wrapper First work on version 1.0.0 2021-02-19 13:04:03 +01:00
.gitlab-ci.yml test new ci config 2020-10-07 16:44:38 +02:00
Dockerfile Add back missing author mention 2021-02-24 15:17:42 +01:00
hocrtotei First work on version 1.0.0 2021-02-19 13:04:03 +01:00
ocr Add back missing author mention 2021-02-24 15:17:42 +01:00
README.md Add new models 2021-02-23 11:11:50 +01:00

OCR - Optical Character Recognition

This software implements a heavily parallelized pipeline to recognize text in PDF files. It is used for nopaque's OCR service but you can also use it standalone, for that purpose a convenient wrapper script is provided.

Software used in this pipeline implementation

Use this image

  1. Create input and output directories for the pipeline.
mkdir -p /<my_data_location>/input /<my_data_location>/output
  1. Place your PDF files inside /<my_data_location>/input. Files should all contain text of the same language.

  2. Start the pipeline process. Check the Pipeline arguments section for more details.

# Option one: Use the wrapper script
## Install the wrapper script (only on first run). Get it from https://gitlab.ub.uni-bielefeld.de/sfb1288inf/ocr/-/raw/1.0.0/wrapper/ocr, make it executeable and add it to your ${PATH}
cd /<my_data_location>
ocr -i input -l <language_code> -o output <optional_pipeline_arguments>

# Option two: Classic Docker style
docker run \
    --rm \
    -it \
    -u $(id -u $USER):$(id -g $USER) \
    -v /<my_data_location>/input:/input \
    -v /<my_data_location>/output:/output \
    gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/ocr:1.0.0 \
        -i /input \
        -l <language_code>
        -o /output \
        <optional_pipeline_arguments>
  1. Check your results in the /<my_data_location>/output directory.

### Pipeline arguments

`-l languagecode`
* Tells tesseract which language will be used.
* options = ara (Arabic), chi_tra (Chinese - Traditional), dan (Danish), deu (German), ell (Greek, Modern (1453-)), eng (English), enm (Middle englisch), fra (French), frk (German Fraktur), frm (Middle french), ita (Italian), por (Portuguese), rus (Russian), spa (Spanish)
* required = True

`--keep-intermediates`
* If set, all intermediate files created during the OCR process will be
kept.
* default = False
* required = False

`--nCores corenumber`
* Sets the number of CPU cores being used during the OCR process.
* default = min(4, multiprocessing.cpu_count())
* required = False

`--skip-binarisation`
* Used to skip binarization with ocropus. If skipped, only the tesseract binarization is used.
* default = False

``` bash
# Example with all arguments used
docker run \
    --rm \
    -it \
    -u $(id -u $USER):$(id -g $USER) \
    -v "$HOME"/ocr/input:/input \
    -v "$HOME"/ocr/output:/output \
    gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/ocr:1.0.0 \
        -i /input \
        -l eng \
        -o /output \
        --keep_intermediates \
        --nCores 8 \
        --skip-binarisation