DocRevive: A Unified Pipeline for Document Text Restoration
Organizations: Computer Vision Center · Indian Statistical Institute, Kolkata
Abstract
In Document Understanding, the challenge of reconstructing damaged, occluded, or incomplete text remains a critical yet unexplored problem. Subsequent document understanding tasks can benefit from a document reconstruction process. In response, this paper presents a novel unified pipeline combining state-of-the-art Optical Character Recognition (OCR), advanced image analysis, masked language modeling, and diffusion-based models to restore and reconstruct text while preserving visual integrity. We create a synthetic dataset of 30{,}078 degraded document images that simulates diverse document degradation scenarios, setting a benchmark for restoration tasks. Our pipeline detects and recognizes text, identifies degradation with an occlusion detector, and uses an inpainting model for semantically coherent reconstruction. A diffusion-based module seamlessly reintegrates text, matching font, size, and alignment. To evaluate restoration quality, we propose a Unified Context Similarity Metric (UCSM), incorporating edit, semantic, and length similarities with a contextual predictability measure that penalizes deviations when the correct text is contextually obvious. Our work advances document restoration, benefiting archival research and digital preservation while setting a new standard for text reconstruction. The OPRB dataset and code are available at Hugging Face and Github respectively.
Figures & tables
| Method | Opaque Classes | Transparent Classes | Special | Average | |||
|---|---|---|---|---|---|---|---|
| B.Ink | Burnt | Whitener | Dust | Stamp | Scribble | Avg. | |
| YOLO26n [ 30 ] | 93.701 | 92.254 | 90.880 | 71.175 | 86.802 | 86.103 | 86.819 |
| YOLOv8n [ 46 ] | 99.452 | 99.498 | 99.483 | 90.498 | 99.500 | 99.270 | 97.950 |
| YOLOv8s [ 46 ] | 99.493 | 99.500 | 99.496 | 91.895 | 99.487 | 99.442 | 98.219 |
| YOLOv9c [ 41 ] | 99.500 | 99.500 | 99.497 | 90.675 | 99.500 | 99.431 | 98.017 |
| YOLOv10b [ 40 ] | 99.490 | 99.487 | 99.454 | 92.153 | 99.079 | 99.288 | 98.159 |
| Model | UCSM | ED | CER | Exact Match (%) |
|---|---|---|---|---|
| RoBERTa-large (fill-mask) [ 22 ] | 0.6102 | 8.2662 | 1.3762 | 21.60 |
| Qwen3-0.6B (causal LM) [ 38 ] | 0.1240 | 7.0928 | 1.0807 | 0.15 |
| Sample Set | UCSM | Exact Match (%) | ED | |||
|---|---|---|---|---|---|---|
| RoBERTa | Qwen3 | RoBERTa | Qwen3 | RoBERTa | Qwen3 | |
| 0-1000 | 0.6131 | 0.1221 | 22.30 | 0.10 | 8.4530 | 7.3240 |
| 1001-2000 | 0.6201 | 0.1243 | 22.40 | 0.10 | 8.2380 | 7.0400 |
| 2001-3000 | 0.6093 | 0.1154 | 21.50 | 0.40 | 8.2000 | 7.0470 |
| 3001-4000 | 0.6175 | 0.1335 | 23.00 | 0.20 | 8.2210 | 7.0370 |
| 4001-5000 | 0.6046 | 0.1317 | 19.90 | 0.10 | 8.3670 | 7.0380 |
| Method and Variant | Precision | Recall | F1-Score | mIoU |
|---|---|---|---|---|
| LinkNet-ResNet18 [ 8 ] | 89.46 | 92.52 | 90.97 | 74.00 |
| LinkNet-ResNet34 [ 8 ] | 87.38 | 91.07 | 89.18 | 74.00 |
| LinkNet-ResNet50 [ 8 ] | 88.58 | 93.56 | 91.00 | 74.00 |
| DB-ResNet50 [ 21 ] | 89.33 | 95.27 | 92.20 | 76.00 |
| DB-MobileNetV3L [ 21 ] | 88.60 | 93.80 | 91.13 | 74.00 |
| FAST-tiny [ 11 ] | 90.68 | 94.63 | 92.61 | 78.00 |
| Method | Accuracy | 1-NED | Confidence |
|---|---|---|---|
| CLIPOCR [ 42 ] | 94.55 | 97.71 | 96.34 |
| DATR [ 29 ] | 89.97 | 96.19 | 90.94 |
| PARSEQ [ 5 ] (Our Baseline) | 95.42 | 98.03 | 95.85 |
| Type | SSIM | FID | UCSM |
|---|---|---|---|
| Black Ink | 0.6844 | 19.10 | 0.6667 |
| Burnt | 0.6859 | 20.50 | 0.9631 |
| Dust | 0.7230 | 20.08 | 0.5138 |
| Scribble | 0.6748 | 19.41 | 0.6352 |
| Stamp | 0.6329 | 38.11 | 0.3717 |
| Whitener | 0.7560 | 14.36 | 0.5104 |
| Prediction | ED | UCSM | |||||
|---|---|---|---|---|---|---|---|
| Example 1: Semantic Blindness Context: “We evaluate the on three benchmark datasets.” GT: “proposed method” | |||||||
| proposed method (exact match) | 0 | 1.000 | 1.000 | 1.000 | 0.000 | 1.000 | |
| proposed methoc (OCR typo) | 1 | 0.933 | 0.665 | 1.000 | 0.000 | 0.853 | |
| suggested approach (synonym) | 13 | 0.278 | 0.859 | 0.833 | 0.000 | 0.584 | |
| random variables (hallucination) | 15 | 0.062 | 0.523 | 0.938 | 0.000 | 0.313 | |
| Example 2: Length Blindness Both predictions have ED = 5, but severity is opposite | |||||||
| Method | SSIM | PSNR | FID |
|---|---|---|---|
| DocDiff | 0.6620 | 16.46 | 43.25 |
| GSDM | 0.6634 | 16.58 | 53.78 |
| NAFNet | 0.6663 | 17.42 | 67.57 |
| DocRevive (Ours) | 0.6814 | 17.23 | 9.00 |
| SSIM | PSNR | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Method | Blk. Ink | Scrib. | Dust | Stamp | Burnt | Whit. | Blk. Ink | Scrib. | Dust | Stamp | Burnt | Whit. |
| DocDiff | 0.6792 | 0.6726 | 0.6416 | 0.6538 | 0.6748 | 0.6500 | 15.90 | 16.90 | 16.45 | 16.12 | 16.91 | 16.51 |
| GSDM | 0.6814 | 0. 6751 | 0.6458 | 0.6556 | 0.6742 | 0.6486 | 16.93 | 17.37 | 15.61 | 15.75 | 17.11 | 16.72 |
| NAFNet | 0.6790 | 0.6699 | 0.6490 | 0.6609 | 0.6805 | 0.6587 | 16.73 | 17.77 | 17.44 | 17.10 | 17.88 | 17.59 |
| DocRevive | 0.6816 | 0.6745 | 0.6833 | 0.6768 | 0.6866 | 0.6855 | 17.24 | 17.09 | 17.26 | 16.83 | 17.48 | 17.50 |