MMDIR: Multimodal Instruction-Driven Framework for Mixed-Degradation Document Image Restoration

Heng Li, Xingyuan Wang, Yang Fan, Yunan Zhang, Xiangping Wu, Qingcai ChenCVPR 2026

TL;DR

MMDIR is a novel multimodal, instruction-driven framework that tackles the challenge of restoring document images plagued by multiple, co-occurring degradations like blur, shadows, watermarks, and seals. By leveraging a large language model (LLM) to textually identify degradations, it generates semantic prompts that guide a specialized vision decoder to reconstruct clean documents. Along with the framework, the authors introduce MixedDoc, a challenging new benchmark dataset specifically designed for mixed-degradation document restoration.

What Problem Does This Paper Address?

Document Image Restoration (DIR) is a critical preprocessing step for downstream tasks like optical character recognition (OCR), table extraction, and document understanding. While deep learning has significantly advanced this field, most existing methods suffer from a major limitation: they assume a single type of degradation (e.g., only blur or only shadows).

In the real world, documents are rarely so cooperative. A scanned contract or mobile-captured invoice might simultaneously suffer from camera shake (blur), poor lighting (shadows), official stamps (seals), and security text watermarks. Existing unified models either require separate training for each degradation type or rely heavily on rigid, error-prone preprocessing pipelines to extract visual priors. MMDIR addresses this gap by creating a unified, prior-free framework capable of dynamically identifying and removing multiple mixed degradations at once.

Comparison of different DIR model patterns.

Methods

MMDIR utilizes an end-to-end multimodal architecture that unifies vision and language understanding. The pipeline operates in two primary phases:

  1. Degradation Identification (LLM Path): The framework accepts a degraded image ($I_d$) and a textual instruction (e.g., "Analyze the image to determine the presence of noise... Then remove shadow."). A ViTDet-based Vision Encoder extracts visual features, which are projected into visual tokens. These tokens are concatenated with text tokens and fed into a frozen Large Language Model (LLM) (Qwen2.5-0.5B). The LLM generates a textual diagnostic response identifying which degradations are present or absent.
  2. Image Restoration (Decoder Path): Instead of relying solely on the LLM's final text output, MMDIR extracts the hidden states ($F_t$) from the LLM's last layer. These states serve as semantically rich, task-adaptive prompts. A Vision Decoder (built on Nonlinear Activation Free Network, or NAFNet, blocks) uses a specialized GuidedLayer to fuse these semantic prompts with multi-scale visual features to reconstruct the clean image ($I_r$).

The model is trained using a multi-task loss function combining standard pixel-level $L_1$ loss, a structural similarity (SSIM) loss, cross-entropy loss for text generation, and a localized $L_1$ loss that uses binary masks to force the model to focus on specific degradation zones (like seals or watermarks).

Figure 2. The architecture of our proposed MMDIR. Our model handles multimodal inputs and outputs for document image restoration. In training stage as shown in the (a) on the left, it takes a Degraded Image Id, a corresponding Question (Text Instruction) and Answer (Degradation Identification) as input. The vision encoder and text embedding first extract multimodal tokens (V, Q, A), which are then fed into a Large Language Model (LLM) to learn cross-modal feature alignment. During the inference stage (in the (b)), only the Id and the Question are used as input to the model. In the Question and Answer, degradation types that are not present in the input image are marked in red, while those actually present are highlighted in green. Other types requiring model identification are labeled in orange. LLM generates text responses by decoding step by step to understand the content of instructions and to identify specific degradation types in the input image. The vision decoder incorporates the semantically enriched answer features from the LLM’s output as guidance. It ultimately reconstructs the restored images (Ir).

Datasets

The authors evaluated MMDIR on both single-degradation public benchmarks and a newly synthesized mixed-degradation dataset:

  • Single Degradation: BMVC (30k training pairs for deblurring) and OSR (237 test images for deshadowing).
  • MixedDoc (New Benchmark): To address the lack of multi-degradation data, the authors synthesized a dataset of 110k images for training and 1,837 images for testing (derived from the M6Doc dataset). Each image contains a randomized combination of 1 to 4 degradations: blur, shadow, text watermark, and seal.

Key Insights and Ideas

  • Semantic Routing via LLM Hidden States: Rather than treating the LLM as a separate text-generation module, MMDIR uses the LLM's internal representations as a dynamic routing mechanism for the vision decoder. This allows the network to adapt its restoration strategy based on its own textual "reasoning."
  • Synergy of Text and Pixels: The multi-task setup proves that explicitly forcing a model to identify a problem textually improves its ability to fix it visually. Ablation studies showed a significant performance drop across all benchmarks when text instructions were removed.
  • The Complexity of Mixed Noise: The authors observed that as the number of concurrent degradation types increases, restoration performance drops. This confirms that mixed degradations interact non-linearly, creating highly complex noise patterns that cannot be solved by simply stacking single-task models.

Key Results

MMDIR achieved state-of-the-art (SOTA) or highly competitive results across the board:

  • Deblurring (BMVC): Achieved SOTA on perceptual metrics, improving LPIPS by 11.2% and DISTS by 43.0% compared to previous methods, yielding much sharper character strokes.
  • Deshadowing (OSR): Outperformed existing models on LPIPS (0.0547) and DISTS (0.0816), avoiding the over-smoothing common in diffusion-based approaches.
  • Mixed Degradation (MixedDoc): Substantially outperformed diffusion-based models like DocDiff and DiffUIR. MMDIR achieved a PSNR of 24.43 and an SSIM of 0.908.
  • Downstream OCR Performance: On the MixedDoc benchmark, MMDIR achieved a Character Error Rate (CER) of 0.17, significantly lower than DocDiff (0.27), while boasting a faster inference speed of 1.51 seconds per image (compared to DocDiff's 3.02s).

Limitations and Future Work

While MMDIR handles mixed degradations remarkably well, its performance still degrades as the number of simultaneous artifacts increases from one to four. The authors note that future work will focus on expanding the variety of covered degradation types (e.g., bleed-through, wrinkles) and improving data authenticity to better mimic real-world document wear and tear.

Summary updated

BibTeX
@inproceedings{li2026mmdir,
  author = {Heng Li and Xingyuan Wang and Yang Fan and Yunan Zhang and Xiangping Wu and Qingcai Chen},
  title = {{MMDIR: Multimodal Instruction-Driven Framework for Mixed-Degradation Document Image Restoration}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=SRW6e3VR8R},
}
Figure