1Institute of Artificial Intelligence and Robotics, Xi'an Jiaotong University · 2The University of Tokyo · *Corresponding Author
TL;DR — ArbDR decomposes arbitrary real-world document distortions—extreme perspective, physical folds, and local text warps—into three lightweight control-grid stages collapsed into a single high-resolution backward warp, reducing AAD error by 14.1%–34.7% across six benchmarks.
Each stage predicts a compact 45 × 31 control grid with only 8.0M parameters, analytically composed so the original image is resampled once without multi-stage blur.
Unlike corner detectors that fail when edges are cut off or backgrounds exceed 60%, L-Net predicts a foreground control grid inside valid paper regions and projects it into affine transform A = Snorm · Ainit via SVD—cropping clutter while preserving text aspect scale.
Operates solely in canonical view O₀ to flatten large-scale folds, curls, and perspective skews, then analytically pulls its 45 × 31 control grid back to raw input coordinates (D₁ = G₁ · A⁻¹) so no intermediate interpolation degrades resolution.
Composes residual grids Dm+1 = Dm ◁ Gm+1 onto a single final remap. Unsupervised Axis-Aligned Line Entropy Halign tracks tracked LSD text/table edges at every step and halts automatically once alignment converges (~1.2 iters avg.).
Too few iterations leave heavy warps curved, while too many iterations over-warp clean layouts and inflate distortion (Table IV: Fixed 5-iter LD jumps 9.135 → 11.071). ArbDR measures foreground line-angle dispersion Halign via RBF tracking and adapts step count per image.
Halign(m) < τ · Halign(m−1) with τ = 0.99.11.071 → 9.528 LD while achieving best AD (0.201), AAD (0.062), and ACER (0.031).
Inspect side-by-side ONNX CPU rectifications spanning large cluttered backgrounds (up to 65% non-document area), incomplete cropped boundaries, and severe physical warps. Click any image to zoom or send straight to the Live Studio.
Evaluated across six public benchmarks (DocUNet, UDIR, WarpDoc, WarpDoc-Crop, DIR300, DocReal) and leading commercial rectification apps.
random) exceed the smoothness prior of the 45 × 31 control grid.
Metric Guide: AAD / AAD-M ↓ measures local geometric angular alignment error against ground-truth unwarping (masked to foreground pixels on incomplete UDIR pages); ACER ↓ measures layout-aligned OCR character error rate independent of reading-order failures.
| Method | DocUNet Benchmark (130 images / 50 OCR) | UDIR Benchmark (Masked Metrics, 195 images / 70 OCR) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MSSIM↑ | LD↓ | AD↓ | AAD↓ | CER (std)↓ | ACER (std)↓ | MSSIM-M↑ | LD-M↓ | AD-M↓ | AAD-M↓ | CER (std)↓ | ACER (std)↓ | |
| DewarpNet | 0.474 | 8.362 | 0.398 | 0.164 | 0.225 (0.210) | 0.088 (0.096) | 0.361 | 18.087 | 0.754 | 0.333 | 0.313 (0.210) | 0.202 (0.154) |
| DDCP* | 0.471 | 9.005 | 0.428 | 0.158 | 0.199 (0.195) | 0.068 (0.069) | 0.360 | 19.366 | 0.650 | 0.259 | 0.243 (0.204) | 0.137 (0.130) |
| DocTr | 0.509 | 7.773 | 0.369 | 0.151 | 0.185 (0.200) | 0.063 (0.061) | 0.381 | 18.834 | 0.735 | 0.310 | 0.289 (0.223) | 0.180 (0.144) |
| DocGeoNet | 0.504 | 7.717 | 0.381 | 0.158 | 0.187 (0.181) | 0.068 (0.083) | 0.381 | 18.730 | 0.742 | 0.316 | 0.287 (0.207) | 0.200 (0.150) |
| PaperEdge | 0.473 | 7.967 | 0.368 | 0.121 | 0.183 (0.218) | 0.057 (0.058) | 0.387 | 16.792 | 0.702 | 0.218 | 0.227 (0.214) | 0.140 (0.142) |
| FAM | 0.497 | 8.416 | 0.377 | 0.151 | 0.176 (0.190) | 0.067 (0.077) | 0.388 | 16.415 | 0.673 | 0.286 | 0.244 (0.215) | 0.133 (0.120) |
| DocScanner | 0.517 | 7.440 | 0.336 | 0.122 | 0.150 (0.176) | 0.054 (0.056) | 0.388 | 18.379 | 0.679 | 0.269 | 0.265 (0.213) | 0.175 (0.141) |
| Layout | 0.525 | 6.707 | 0.300 | 0.122 | 0.180 (0.203) | 0.057 (0.057) | — | — | — | — | — | — |
| DocTr++ | 0.464 | 9.301 | 0.371 | 0.146 | 0.204 (0.209) | 0.061 (0.056) | 0.452 | 12.448 | 0.529 | 0.216 | 0.319 (0.306) | 0.115 (0.141) |
| UVDoc | 0.545 | 6.827 | 0.316 | 0.125 | 0.193 (0.209) | 0.065 (0.067) | 0.396 | 17.260 | 0.571 | 0.239 | 0.210 (0.187) | 0.134 (0.130) |
| DocRes | 0.466 | 9.371 | 0.472 | 0.199 | 0.227 (0.207) | 0.085 (0.082) | 0.391 | 22.757 | 0.914 | 0.368 | 0.459 (0.312) | 0.367 (0.316) |
| AADD | 0.543 | 6.249 | 0.278 | 0.099 | 0.150 (0.166) | 0.054 (0.059) | 0.406 | 17.191 | 0.593 | 0.193 | 0.189 (0.189) | 0.115 (0.127) |
| Ours (ArbDR) | 0.519 | 6.198 | 0.260 | 0.085 | 0.166 (0.195) | 0.049 (0.050) | 0.489 | 10.345 | 0.404 | 0.126 | 0.286 (0.306) | 0.103 (0.151) |
| Method | Total FPS↑ | Model FPS↑ | WarpDoc Benchmark (1,020 images / 120 OCR) | WarpDoc-Crop Benchmark (1,020 images / 120 OCR) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MSSIM↑ | LD↓ | AD↓ | AAD↓ | CER (std)↓ | ACER (std)↓ | MSSIM↑ | LD↓ | AD↓ | AAD↓ | CER (std)↓ | ACER (std)↓ | |||
| DewarpNet | 0.49 | 56.4 | 0.327 | 31.075 | 0.892 | 0.364 | 0.540 (0.216) | 0.335 (0.182) | 0.465 | 13.303 | 0.453 | 0.206 | 0.258 (0.235) | 0.138 (0.136) |
| DDCP* | 0.47 | 118.1 | 0.357 | 23.387 | 0.718 | 0.279 | 0.386 (0.249) | 0.201 (0.171) | 0.475 | 14.016 | 0.470 | 0.195 | 0.230 (0.238) | 0.116 (0.133) |
| DocTr | 0.52 | 23.1 | 0.394 | 27.003 | 0.776 | 0.298 | 0.380 (0.250) | 0.214 (0.172) | 0.521 | 11.703 | 0.347 | 0.146 | 0.145 (0.200) | 0.075 (0.113) |
| DocGeoNet | 0.56 | 22.1 | 0.402 | 24.700 | 0.756 | 0.307 | 0.396 (0.255) | 0.246 (0.183) | 0.523 | 11.602 | 0.364 | 0.157 | 0.165 (0.213) | 0.082 (0.109) |
| PaperEdge | 0.46 | 77.0 | 0.397 | 20.333 | 0.589 | 0.195 | 0.219 (0.230) | 0.141 (0.150) | 0.507 | 11.271 | 0.325 | 0.110 | 0.110 (0.172) | 0.067 (0.110) |
| FAM | 0.51 | 7.3 | 0.368 | 26.781 | 0.755 | 0.296 | 0.438 (0.250) | 0.292 (0.212) | 0.519 | 11.964 | 0.367 | 0.154 | 0.173 (0.220) | 0.091 (0.124) |
| DocScanner | 0.59 | 21.8 | 0.392 | 27.499 | 0.637 | 0.226 | 0.267 (0.271) | 0.153 (0.163) | 0.527 | 11.753 | 0.316 | 0.116 | 0.123 (0.193) | 0.058 (0.100) |
| DocTr++ | — | — | 0.245 | 43.126 | 1.077 | 0.338 | 0.519 (0.283) | 0.360 (0.248) | 0.509 | 12.292 | 0.363 | 0.155 | 0.173 (0.213) | 0.097 (0.140) |
| UVDoc | 0.69 | 67.6 | 0.358 | 26.277 | 0.632 | 0.256 | 0.379 (0.249) | 0.199 (0.162) | 0.551 | 10.104 | 0.278 | 0.120 | 0.129 (0.192) | 0.066 (0.099) |
| DocRes | 0.41 | 27.2 | 0.501 | 12.856 | 0.455 | 0.197 | 0.272 (0.227) | 0.157 (0.149) | 0.503 | 13.065 | 0.424 | 0.185 | 0.218 (0.214) | 0.119 (0.129) |
| AADD | 0.56 | 67.0 | 0.514 | 15.642 | 0.276 | 0.095 | 0.128 (0.206) | 0.054 (0.090) | 0.566 | 9.610 | 0.218 | 0.081 | 0.098 (0.166) | 0.041 (0.051) |
| Ours (ArbDR) | 0.51 | 48.9 | 0.534 | 9.528 | 0.201 | 0.062 | 0.079 (0.157) | 0.031 (0.038) | 0.544 | 8.900 | 0.198 | 0.059 | 0.073 (0.137) | 0.034 (0.044) |
| Method | DIR300 Benchmark (300 images) | DocReal Benchmark (200 images, Chinese OCR) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MSSIM↑ | LD↓ | AD↓ | AAD↓ | CER (std)↓ | ACER (std)↓ | MSSIM↑ | LD↓ | AD↓ | AAD↓ | CER (std)↓ | ACER (std)↓ | |
| DewarpNet | 0.492 | 13.944 | 0.332 | 0.147 | 0.336 (0.692) | 0.146 (0.136) | 0.481 | 13.396 | 0.348 | 0.146 | 0.510 (0.485) | 0.423 (0.335) |
| DDCP* | 0.552 | 11.025 | 0.357 | 0.133 | 0.257 (0.635) | 0.093 (0.107) | 0.463 | 16.015 | 0.458 | 0.138 | 0.490 (0.424) | 0.404 (0.342) |
| DocTr | 0.616 | 7.189 | 0.255 | 0.107 | 0.211 (0.364) | 0.085 (0.093) | 0.551 | 12.666 | 0.329 | 0.129 | 0.503 (0.431) | 0.389 (0.306) |
| DocGeoNet | 0.638 | 6.403 | 0.241 | 0.106 | 0.206 (0.356) | 0.091 (0.091) | 0.553 | 12.079 | 0.323 | 0.130 | 0.518 (0.575) | 0.398 (0.412) |
| PaperEdge | 0.584 | 7.968 | 0.255 | 0.091 | 0.177 (0.614) | 0.063 (0.095) | 0.519 | 11.395 | 0.305 | 0.089 | 0.514 (0.544) | 0.358 (0.436) |
| FAM | 0.607 | 7.680 | 0.243 | 0.108 | 0.198 (0.369) | 0.090 (0.098) | 0.512 | 13.247 | 0.354 | 0.138 | 0.494 (0.393) | 0.422 (0.398) |
| DocScanner | 0.623 | 7.021 | 0.226 | 0.089 | 0.168 (0.354) | 0.070 (0.081) | 0.542 | 12.346 | 0.314 | 0.114 | 0.514 (0.551) | 0.385 (0.399) |
| DocTr++ | 0.484 | 19.478 | 0.346 | 0.144 | 0.290 (0.660) | 0.143 (0.157) | 0.444 | 19.723 | 0.353 | 0.128 | 0.519 (0.577) | 0.428 (0.403) |
| UVDoc | 0.621 | 7.730 | 0.219 | 0.101 | 0.237 (0.754) | 0.089 (0.104) | 0.549 | 11.216 | 0.270 | 0.108 | 0.497 (0.510) | 0.392 (0.425) |
| DocRes | 0.627 | 6.820 | 0.242 | 0.105 | 0.227 (0.380) | 0.105 (0.117) | 0.551 | 11.440 | 0.347 | 0.142 | 0.489 (0.449) | 0.401 (0.344) |
| AADD | 0.702 | 4.261 | 0.131 | 0.057 | 0.132 (0.251) | 0.047 (0.067) | 0.615 | 8.791 | 0.193 | 0.075 | 0.484 (0.509) | 0.347 (0.356) |
| Ours (ArbDR) | 0.658 | 5.044 | 0.143 | 0.054 | 0.174 (0.638) | 0.042 (0.057) | 0.577 | 9.168 | 0.190 | 0.061 | 0.469 (0.476) | 0.339 (0.348) |
| Group | Setting | MSSIM↑ | LD↓ | AD↓ | AAD↓ | CER (std)↓ | ACER (std)↓ |
|---|---|---|---|---|---|---|---|
| Geometric Transform (GT) | GT: Similarity (S) | 0.530 | 9.798 | 0.214 | 0.062 | 0.072 (0.143) | 0.031 (0.038) |
| GT: Perspective (P) | 0.531 | 9.839 | 0.219 | 0.062 | 0.083 (0.158) | 0.030 (0.040) | |
| GT: Affine (Ours) | 0.534 | 9.528 | 0.201 | 0.062 | 0.079 (0.157) | 0.031 (0.038) | |
| Iteration Strategy (IS) | IS: 0 (C-Net only) | 0.528 | 9.135 | 0.212 | 0.078 | 0.088 (0.162) | 0.036 (0.048) |
| IS: 1 (Fixed 1) | 0.536 | 9.474 | 0.205 | 0.062 | 0.081 (0.161) | 0.033 (0.041) | |
| IS: 2 (Fixed 2) | 0.533 | 9.962 | 0.215 | 0.062 | 0.071 (0.135) | 0.034 (0.037) | |
| IS: 3 (Fixed 3) | 0.529 | 10.404 | 0.229 | 0.063 | 0.068 (0.136) | 0.033 (0.038) | |
| IS: 4 (Fixed 4) | 0.526 | 10.714 | 0.245 | 0.063 | 0.074 (0.154) | 0.033 (0.040) | |
| IS: 5 (Fixed 5) | 0.524 | 11.071 | 0.259 | 0.065 | 0.067 (0.131) | 0.035 (0.040) | |
| IS: Adaptive (Ours) | 0.534 | 9.528 | 0.201 | 0.062 | 0.079 (0.157) | 0.031 (0.038) | |
| Affine Loss (AL) | AL: w/o L_Affine | 0.536 | 10.150 | 0.211 | 0.064 | 0.070 (0.141) | 0.032 (0.040) |
| AL: with L_Affine (Ours) | 0.534 | 9.528 | 0.201 | 0.062 | 0.079 (0.157) | 0.031 (0.038) |
| Commercial Apps on UDIR (Table III) | ||||||
|---|---|---|---|---|---|---|
| Method | MSSIM-M↑ | LD-M↓ | AD-M↓ | AAD-M↓ | CER↓ | ACER↓ |
| Youdao | 0.334 | 23.931 | 0.993 | 0.452 | 0.307 | 0.190 |
| Baidu | 0.378 | 17.897 | 0.578 | 0.201 | 0.227 | 0.111 |
| TextIn | 0.449 | 12.081 | 0.375 | 0.120 | 0.181 | 0.087 |
| Ours (ArbDR) | 0.489 | 10.345 | 0.404 | 0.126 | 0.286 | 0.103 |
| CPU ONNX Runtime (deploy/benchmark_cpu.py) | |||
|---|---|---|---|
| Runtime Mode | Latency↓ | Speedup↑ | PSNR Parity |
| PyTorch CPU (Adaptive) | 995.0 ms | 1.00× | Reference |
| ONNX Runtime CPU (Adaptive) | 1342.4 ms | 0.74× | 50.33 dB (0.295 MAE) |
| ONNX Runtime CPU (Fast 1-iter) | 691.6 ms | 1.44× | 30.59 dB (Zero PyTorch) |
Runs native-resolution ONNX Runtime inference on CPU with analytic grid composition — directly inside your browser via WebAssembly on Hugging Face Spaces / GitHub Pages, or via local Python deploy/web_server.py. Drop any photo onto the canvas or click a sample below.
Input I₀
Stage 1 · L-Net (O₀)
Stage 2 · C-Net (O₁)
Stage 3 · F-Net (Final)
Run lightweight CPU inference with zero PyTorch dependencies, reproduce full IEEE TMM paper benchmarks on GPU, or deploy this studio as a self-contained Docker / Hugging Face Space.
git clone https://github.com/chaoyunwang/ArbDR.git && cd ArbDR pip install -r deploy/requirements_cpu_onnx.txt python scripts/download_weights.py --onnx # Batch rectification on CPU (Fast 1-Iter or full Adaptive stopping) python deploy/infer_onnx.py --input assets/samples --output outputs/cpu_demo --fast_mode # Launch local Project Page + Live CPU Demo at http://127.0.0.1:7860 python deploy/web_server.py --host 127.0.0.1 --port 7860
pip install -r requirements.txt python scripts/download_weights.py --all # arbdr.pkl (91.6 MB) + RAFT ONNX # Full 3-stage adaptive rectification (paper default) python infer.py --checkpoint checkpoints/arbdr.pkl --input <WARPED_DIR> --output outputs/rectified # Evaluate geometric (MSSIM, LD, AD, AAD / masked -M) & Layout-Aligned OCR (ACER/AED) python eval/evaluate.py --rect_dir outputs/rectified --gt_dir <GT_DIR> --dataset docunet
# Minimal Python inference API (no PyTorch required)
from deploy.infer_onnx import ArbDROnnxEngine
import cv2
engine = ArbDROnnxEngine(model_dir="deploy/models", num_threads=4)
out = engine.rectify(cv2.imread("photo.jpg"), max_iter=5, iter_mode="adaptive")
cv2.imwrite("rectified.png", out["rectified_bgr"])
# Build a ready-to-push Hugging Face Spaces Docker bundle (CPU Basic Free Tier)
python deploy/huggingface_space/prepare_space.py --output ../ArbDR-HF-Space
Official 24.0M-param checkpoint (arbdr.pkl) via download_weights.py or Baidu Netdisk (mdqd).
Three exported FP32 ONNX graphs with analytic NumPy grid composition achieving 50.33 dB PSNR parity on CPU.
Runs live in-browser via ONNX Runtime Web (HF Space), plus optional non-root Dockerfile in deploy/huggingface_space/.
@article{wang2026arbdr,
title={Cascaded Robust Rectification for Arbitrary Document Images},
author={Wang, Chaoyun and Huang, Quanxin and Shen, I-Chao and Igarashi, Takeo and Zheng, Nanning and Jiang, Caigui},
journal={IEEE Transactions on Multimedia},
year={2026},
doi={10.1109/TMM.2026.3689432}
}