No description
Find a file
Clemens Neudecker eff7a47852
Merge pull request #52 from bertsky/img-allow-alpha
allow alpha channels
2022-10-11 13:11:44 +02:00
.circleci use resmgr for model download 2021-01-28 14:09:18 +01:00
repo add assets subrepo 2020-10-15 17:31:47 +02:00
sbb_binarize load_model: also allow SavedModel directories 2022-10-11 07:21:17 +00: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.10 2022-07-21 15:00:31 +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 fix test 2021-01-28 14:19:22 +01:00
ocrd-tool.json add ocrd-tool.json 2020-10-15 15:19:04 +02:00
README.md Update README 2022-10-11 11:37:00 +02:00
requirements.txt depend on tensorflow not tensorflow-gpu, drop holding h5py 2022-05-03 22:25:51 +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 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"