Uni-DocDiff: A Unified Document Restoration Model Based on Diffusion

Fangmin Zhao, Weichao Zeng, Zhenhang Li, Dongbao Yang, Binbin Li, Xiaojun Bi, Yu Zhou

Abstract

Document restoration often involves addressing multiple concurrent degradations such as blur, shadows, and geometric warping. Traditional approaches rely on task-specific "expert" models, which lack scalability and efficiency. We present Uni-DocDiff, a unified framework that utilizes a dual-stream diffusion-based architecture. By incorporating a "Prior Pool" of frequency-based features and a Prior Fusion Module (PFM), Uni-DocDiff effectively mitigates task interference. Experimental results demonstrate that Uni-DocDiff achieves state-of-the-art performance across six restoration tasks, offering a scalable solution for complex document image enhancement.

Introduction

Document images captured in uncontrolled environments frequently suffer from a "cocktail" of degradations. While all-in-one models have been proposed, they typically struggle with two major hurdles:

  1. Task Interference: Different restoration tasks focus on conflicting image features. For instance, deblurring necessitates high-frequency edge details, whereas deshadowing requires understanding global low-frequency illumination context. Combining these in a single model often leads to conflicting gradient updates.
  2. Scalability: Many existing models rely on handcrafted prompts or heavy preprocessing, making it difficult to extend the system to new restoration tasks without significant redesign.

Methods

Uni-DocDiff employs a dual-stream architecture to decouple pixel-level restoration from geometric correction, ensuring both high fidelity and computational efficiency.

Dual-Stream Architecture

  • Pixel Prediction Branch (PPB): A diffusion-based backbone handles generative tasks like deblurring, deshadowing, and binarization. Diffusion is utilized for its ability to generate high-quality, fine-grained details.
  • Coordinate Prediction Branch (CPB): A lightweight, non-iterative branch dedicated to dewarping. Since dewarping is a geometric mapping problem, this branch avoids the iterative cost of diffusion.

Prior Pool and PFM

To resolve the frequency conflict between tasks, the authors introduce a Prior Pool consisting of traditional image processing operators (e.g., Sobel and Canny for high-frequency edges; Gaussian and DCT for low-frequency backgrounds). The Prior Fusion Module (PFM) adaptively selects and weights the most relevant features from this pool based on the specific task and the current stage of the diffusion process.

The Uni-DocDiff architecture featuring the Prior Pool Generator, Pixel Prediction Branch (PPB), and Coordinate Prediction Branch (CPB).

Key Results

Uni-DocDiff was evaluated on a massive collection of standard document benchmarks across six tasks. The model achieved state-of-the-art (SOTA) or near-SOTA results in every category:

  • Deblurring: Achieved a PSNR of 28.77 on the Text Deblur Dataset (TDD), significantly outperforming previous unified models.
  • Dewarping: On the DIR300 dataset, it achieved a Local Distortion (LD) score of 5.30, outperforming specialized models like DocGeo.
  • Handwriting Removal: The model effectively distinguishes between printed text and handwriting, preserving the former with high fidelity (0.9685 MS-SSIM).
Qualitative results of Uni-DocDiff across six document restoration tasks compared to ground truth (GT).

Conclusion and Future Work

Uni-DocDiff demonstrates that a unified, diffusion-based approach can handle complex document degradations by explicitly managing frequency-domain features. While highly versatile, future work will focus on expanding the task range to include niche degradations like watermark removal and optimizing inference speed for real-time mobile applications. Additionally, exploring inter-task synergies—how one restoration task might facilitate another—remains a promising avenue for research.

Summary updated

BibTeX
@inproceedings{zhao2025uni,
  author = {Fangmin Zhao and Weichao Zeng and Zhenhang Li and Dongbao Yang and Binbin Li and Xiaojun Bi and Yu Zhou},
  title = {{Uni-DocDiff: A Unified Document Restoration Model Based on Diffusion}},
  booktitle = {ACM Multimedia},
  year = {2025},
  doi = {10.1145/3746027.3755362},
}
Figure