Go to file
Clemens Neudecker eff7a47852
Merge pull request from bertsky/img-allow-alpha
allow alpha channels
.circleci use resmgr for model download
repo add assets subrepo
sbb_binarize load_model: also allow SavedModel directories
.gitignore 📦 v0.0.2
.gitkeep Add new directory, you can find corresponding models in qurator-data
.gitmodules add assets subrepo
CHANGELOG.md 📦 v0.0.10
LICENSE Add LICENSE
Makefile fix test
README.md Update README
make.sh Add new file
ocrd-tool.json add ocrd-tool.json
requirements.txt depend on tensorflow not tensorflow-gpu, drop holding h5py
setup.py minimal CI setup

README.md

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 h5 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

Usage

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

In virtually all cases, applying the --patches flag will improve the quality of results.

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

Example

sbb_binarize --patches -m /path/to/models/ myimage.tif myimage-bin.tif

To use the OCR-D interface:

ocrd-sbb-binarize --overwrite -I INPUT_FILE_GRP -O OCR-D-IMG-BIN -P model "/var/lib/sbb_binarization"