UVDoc β GGUF for docscan-rs
GGUF conversions of UVDoc (Floor Verhoeven, Tanguy Magne, Olga Sorkine-Hornung,
UVDoc: Neural Grid-based Document Unwarping, SIGGRAPH Asia 2023), the
model/best_model.pkl checkpoint published in
tanguymagne/UVDoc (MIT), for
docscan-rs, a Rust/Candle port.
A phone photo of a document in, a flat, cropped scan out: perspective, page curl,
shadows and colour cast removed; PNG, JPEG or PDF.
Not for llama.cpp. Single-file GGUFs in the docscan-rs layout: batch norms folded into the convolutions, the training-only 3-D head dropped (2-D grid head only).
| file | size | convolution weights | grid vs PyTorch |
|---|---|---|---|
uvdoc-f32.gguf |
32 MB | F32 | 0.003 px (recommended) |
uvdoc-f16.gguf |
16 MB | F16 | 0.1 px |
Biases and the PReLU slope stay F32. About 0.5 s for an 8 MP photo on CPU, 0.2 s on CUDA (whole pipeline: decode, network, unwarp, enhancement).
Usage
git clone https://github.com/rzafiamy/docscan-rs && cd docscan-rs
./build.sh # or --cuda / --metal
docscan scan -m uvdoc-f32.gguf photo.jpg -o scan.png
docscan scan -m uvdoc-f32.gguf --mode bw photo.jpg -o scan.pdf --paper a4
docscan serve -m uvdoc-f32.gguf --port 8791 # POST /v1/documents/scans, /v1/documents/detect
Also served by zallama (modality: docscan,
POST /v1/documents/scans).
docscan-rs is conservative by design: the geometry is resampling and the enhancement a per-pixel tone curve, with no generative model, so digits, signatures and stamps are never redrawn.
Reproduce
docscan convert best_model.pkl -o uvdoc-f32.gguf --name uvdoc
docscan convert best_model.pkl -o uvdoc-f16.gguf --name uvdoc --dtype f16
License
MIT, as the original weights (Β© 2023 Tanguy Magne, see LICENSE); this repository only
changes their file format. docscan-rs itself is Apache-2.0.
@inproceedings{UVDoc,
title={{UVDoc}: Neural Grid-based Document Unwarping},
author={Floor Verhoeven and Tanguy Magne and Olga Sorkine-Hornung},
booktitle={SIGGRAPH ASIA, Technical Papers},
year={2023},
url={https://doi.org/10.1145/3610548.3618174}
}
- Downloads last month
- 88
16-bit
32-bit