Downloads · 30 days
0
nathansut1/sbb-binarization-onnx
sbb-binarization-onnx is a machine learning model from nathansut1. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for onnxruntime. The card lists the license as apache-2.0.
ONNX conversion of SBB/sbbbinarization by the Berlin State Library (Staatsbibliothek zu Berlin), developed as part of the QURATOR project.
Downloads · 30 days
0
Access
Public
Updated Mar 19, 2026
Repo size
149 MB
Likes
0
Public
Click a slice to open those files.
.onnx149 MB · 100%
From the Hugging Face model README
ONNX conversion of SBB/sbb_binarization by the Berlin State Library (Staatsbibliothek zu Berlin), developed as part of the QURATOR project.
The original model is a UNet + Vision Transformer hybrid that converts scanned document images to black and white for OCR. It works on 448x448 patches.
pip install onnxruntime-gpu numpy Pillow
python3 sample_workflow.py input.jpg output.tif
The original TF model doesn't convert cleanly to ONNX for TensorRT. Three things needed fixing:
All of this is in fix_onnx.py. To reproduce from scratch:
pip install tf2onnx onnx tensorflow
python3 -m tf2onnx.convert --saved-model path/to/saved_model/2022-08-16 --output model.onnx --opset 17
python3 fix_onnx.py model.onnx model_convtranspose.onnx
Output is <0.01% pixel difference from the original TF model.
Same as the original — Apache 2.0. All credit to the SBB team and the QURATOR project for the model itself.