No description
Find a file
2023-04-12 23:49:04 +02:00
.circleci Updated config.yml 2023-04-12 23:49:04 +02:00
.github/workflows GHA: clone submodules 2023-04-12 23:46:52 +02:00
repo add assets subrepo 2020-10-15 17:31:47 +02:00
sbb_binarize fix region level 2023-04-12 22:41:01 +02:00
.gitignore 📦 v0.0.2 2020-10-23 17:09:54 +02:00
.gitkeep Add new directory, you can find corresponding models in qurator-data 2019-08-23 15:47:32 +02:00
.gitmodules add assets subrepo 2020-10-15 17:31:47 +02:00
CHANGELOG.md 📦 v0.0.11 2022-10-24 16:57:22 +02:00
LICENSE Add LICENSE 2019-12-10 16:40:44 +01:00
make.sh Add new file 2019-08-23 15:50:09 +02:00
Makefile Update Makefile 2023-04-12 23:31:23 +02:00
ocrd-tool.json add ocrd-tool.json 2020-10-15 15:19:04 +02:00
README.md improve/update tests 2023-04-12 22:55:12 +02:00
requirements.txt Update requirements.txt 2022-10-11 17:20:31 +02:00
setup.py minimal CI setup 2020-10-16 13:52:44 +02:00

Binarization

Binarization for document images

Examples

Introduction

This tool performs document image binarization using a trained ResNet50-UNet model.

Installation

Clone the repository, enter it and run

pip install .

Models

Pre-trained models in HDF5 format can be downloaded from here:

https://qurator-data.de/sbb_binarization/

We also provide a Tensorflow saved_model via Huggingface:

https://huggingface.co/SBB/sbb_binarization

With OCR-D, you can use the [Resource Manager](Tensorflow SavedModel) to deploy models, e.g.

ocrd resmgr download ocrd-sbb-binarize "*"

Usage

sbb_binarize \
  -m <path to directory containing model files \
  <input image> \
  <output image>

Images containing a lot of border noise (black pixels) should be cropped beforehand to improve the quality of results.

Example

sbb_binarize -m /path/to/model/ myimage.tif myimage-bin.tif

To use the OCR-D interface:

ocrd-sbb-binarize -I INPUT_FILE_GRP -O OCR-D-IMG-BIN -P model default

Testing

For simple smoke tests, the following will

  • download models

  • download test data

  • run the OCR-D wrapper (on page and region level):

    make model make test