Predicting the Original Appearance of Damaged Historical Documents

Zhenhua Yang, Dezhi Peng, Yongxin Shi, Yuyi Zhang, Chongyu Liu, Lianwen Jin

Abstract

Historical documents are vital cultural artifacts that often suffer from severe physical degradation, including missing text and ink erosion. This paper introduces the task of Historical Document Repair (HDR), which moves beyond simple image cleaning to the semantic and stylistic reconstruction of lost content. We present HDR28K, a large-scale dataset of over 28,000 image pairs, and DiffHDR, a specialized diffusion model designed for high-fidelity restoration. By leveraging content and mask priors alongside a novel Character Perceptual Loss, DiffHDR achieves an 81.9% character recognition accuracy, significantly outperforming existing restoration frameworks.

The Challenge of Historical Document Repair

Historical manuscripts are our primary link to the past, yet they are inherently fragile. Centuries of oxidation, water damage, and insect activity often leave them with missing characters, "ink erosion," and physical holes. While computer vision has excelled at "low-level" document tasks—such as shadow removal or binarization—these methods fail when the underlying data is physically gone.

Existing tools cannot effectively "hallucinate" a missing stroke of a 1,000-year-old Hanzi character while maintaining the specific calligraphic style of the original scribe. Document repair is a complex multimodal challenge: the system must understand both the semantic context (what the word should be) and the visual texture (how the paper and ink should look).

The DiffHDR Framework

To address these challenges, the authors propose DiffHDR, a framework based on Denoising Diffusion Probabilistic Models (DDPM). Unlike standard diffusion models that predict Gaussian noise, DiffHDR is optimized to directly predict the repaired image. This direct prediction approach was found to be more effective for preserving the fine-grained details required for calligraphy.

The DiffHDR model transforms damaged historical documents into repaired versions by reconstructing missing text and paper textures.

Technical Innovations

  • Condition Parsing: The model utilizes two extra "priors": a content image ($x_c$) representing the semantic text to be restored, and a mask image ($x_m$) indicating the spatial location of the damage.
  • Character Perceptual Loss (CPLoss): To ensure restored characters are structurally sound rather than blurry artifacts, the team introduced a loss function using a pre-trained VGG network. This forces the model to respect the calligraphic integrity of the text.
  • Attribute-Sensitive Repair: Using a classifier-free guidance approach, the model can be tuned during inference to be more or less sensitive to the provided content and mask, allowing for flexible editing.

Data and Evaluation

Because no large-scale "damaged vs. perfect" historical document dataset existed, the authors created HDR28K, consisting of 28,552 image pairs with character-level annotations. They applied three synthetic degradations to high-quality scans: character missing (via inpainting), paper damage (simulating holes), and ink erosion (simulating water damage and fading).

The PSNR Paradox

A key insight from this research is that traditional metrics like PSNR (Peak Signal-to-Noise Ratio) and SSIM are often unsuitable for document repair. A model might produce a blurry, unreadable character that achieves a high PSNR score, while a sharp, readable character that is slightly shifted receives a lower score. Consequently, the authors emphasize Rec-ACC (Character Recognition Accuracy) as the primary metric for success.

Key Results

DiffHDR significantly outperformed state-of-the-art models like NAFNet, Restormer, and Uformer:

  • Visual Realism: It achieved a 12.7% lower FID and an 11.7% lower LPIPS score than the second-best model.
  • Readability: In Rec-ACC tests, DiffHDR reached 81.9%, beating the next best model (Uformer-Big) by nearly 12%.
  • Generalization: Despite being trained on synthetic data, the model demonstrated remarkable performance on authentic damaged documents sourced from the internet.

Future Directions

Currently, DiffHDR requires human-in-the-loop input to provide the content and location of damaged characters. The authors suggest that the next evolutionary step is the integration of Large Vision-Language Models (LVLMs). These models could potentially "read" the surrounding context of a damaged page to automatically predict missing characters, creating a fully autonomous end-to-end restoration pipeline.

Summary updated

BibTeX
@inproceedings{yang2025predicting,
  author = {Zhenhua Yang and Dezhi Peng and Yongxin Shi and Yuyi Zhang and Chongyu Liu and Lianwen Jin},
  title = {{Predicting the Original Appearance of Damaged Historical Documents}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i9.33016},
}
Figure