TL;DR
DocDiff is the first diffusion-based framework specifically designed for document enhancement tasks like deblurring, denoising, and watermark removal. By combining a coarse predictor with a high-frequency residual refinement module, it generates crisp text edges and achieves state-of-the-art perceptual quality with as few as five sampling steps.
What Problem Does This Paper Address?
Restoring degraded document images—whether they are blurry, noisy, or covered in watermarks—is critical for both human readability and the performance of Optical Character Recognition (OCR) systems.
Traditional deep learning approaches usually rely on regression-based CNNs. While these models achieve high Peak Signal-to-Noise Ratio (PSNR) scores, they often suffer from "regression to the mean," resulting in blurry, distorted text edges that confuse OCR engines. Generative Adversarial Networks (GANs) can produce sharper results but are notoriously unstable and prone to "mode collapse" when dealing with the repetitive patterns found in high-resolution documents.
Standard diffusion models, while excellent at generating realistic details, are typically too slow for practical document processing and can introduce "diversity" that inadvertently changes the semantic meaning of characters (e.g., turning an 'e' into an 'o').
Methods
The authors introduce DocDiff, a lightweight (8M parameters) two-stage framework:
- Coarse Predictor (CP): A compact U-Net that restores the primary, low-frequency content of the image. It handles the "heavy lifting" of denoising but leaves the edges slightly blurred.
- High-Frequency Residual Refinement (HRR): This is the core innovation. Instead of predicting the entire image, this diffusion-based module predicts the residual (the difference) between the ground truth and the CP’s output.
Key Technical Innovations:
- Predicting $x_0$ instead of $\epsilon$: Unlike standard diffusion models that predict added noise ($\epsilon$), DocDiff predicts the original residual ($x_0$). This significantly improves generation quality in the first few steps of the reverse process, allowing for much faster inference.
- Frequency Separation Training: The model uses Laplacian kernels to explicitly separate high-frequency edge information from low-frequency content during training, forcing the HRR module to specialize in sharpening text boundaries.
- Deterministic Short-Step Sampling: By using a deterministic sampling strategy, the authors eliminate the randomness that causes character distortion, ensuring the output remains faithful to the original text.
Datasets
The model was evaluated on several benchmarks:
- Document Deblurring Dataset: 66,000 pairs of clean and blurry document patches.
- (H-)DIBCO 2018 & 2019: Standard datasets for document binarization and denoising.
- Synthetic Watermark & Seal Datasets: The authors created new paired datasets using in-house documents to train the model to remove dense watermarks and red Chinese seals while preserving the underlying text.
Key Insights and Ideas
- Residuals are the Key: By focusing the diffusion process on the residual rather than the whole image, the model doesn't have to "re-learn" the basic structure of the document, making it more efficient and stable.
- Plug-and-Play Sharpening: One of the most impressive findings is that the HRR module is "plug-and-play." It can be used to sharpen the blurry outputs of other existing SOTA models (like HINet or DE-GAN) without any additional joint training.
- Efficiency Matters: Document images are often multi-megapixel. By keeping the parameter count low (~8M) and the sampling steps short (5-20), DocDiff moves diffusion models closer to real-world deployment in document analysis pipelines.
Key Results
DocDiff achieves significant improvements in perceptual metrics, which correlate better with human vision than traditional distortion metrics:
- Deblurring: On the Document Deblurring Dataset, DocDiff reduced the Learned Perceptual Image Patch Similarity (LPIPS) score by 66% compared to MPRNet and 64% compared to DE-GAN.
- OCR Performance: For deblurring, DocDiff reduced the character error rate (CER) from a baseline of 13.7% (DE-GAN) down to 4.4%. For watermark/seal removal, it improved CER from 28.7% to a mere 1.8%.
- Speed: The model achieves competitive performance with only 5 sampling steps, making it significantly faster than traditional diffusion approaches.
Limitations and Future Work
While DocDiff is highly effective, the authors note that character distortion can still occur in extreme cases (e.g., a word like "Therefore" might be reconstructed as "Therofore").
Future directions include: * Incorporating semantic text priors to ensure that the reconstructed characters are linguistically valid. * Expanding the dataset to include more real-world paired samples to improve generalizability across diverse document types and languages. * Using DocDiff as an assisted annotation tool to help humans label degraded historical documents more efficiently.
Summary updated