Abstract
Unlike general image deblurring that prioritizes perceptual quality, QR code deblurring focuses on ensuring successful decoding. QR codes are characterized by highly structured patterns with sharp edges, a robust prior for restoration. Yet existing deep learning methods rarely exploit these priors explicitly. To address this gap, we propose the Edge-Guided Attention Block (EGAB), which embeds explicit edge priors into a Transformer architecture. Based on EGAB, we develop Edge-Guided Restormer (EG-Restormer), an effective network that significantly boosts the decoding rate of severely blurred QR codes. For mildly blurred inputs, we design the Lightweight and Efficient Network (LENet) for fast deblurring. We further integrate these two networks into an Adaptive Dual-network (ADNet), which dynamically selects the suitable network based on input blur severity, making it ideal for resource-constrained mobile devices. Extensive experiments show that our EG-Restormer and ADNet achieve state-of-the-art performance with a competitive speed.
Introduction: Prioritizing Decodability over Aesthetics
Most research in image deblurring aims to improve the visual quality of natural scenes for human consumption. However, in the context of QR codes, the primary objective is functional: decodability. QR codes are highly structured, consisting of discrete black-and-white modules. This structure implies a specific statistical property—sharp edges—that distinguishes them from natural images.
As shown in the figure above, the log-scale gradient histogram of a QR code is significantly different from that of a natural image. While natural images have a smooth distribution, QR codes show periodic peaks corresponding to their modular structure. Standard deep learning models often overlook these unique priors, treating QR codes like any other image. Furthermore, high-performance models like Transformers are often too computationally expensive for real-time mobile applications.
The ADNet Framework
To bridge the gap between restoration quality and computational efficiency, we propose ADNet (Adaptive Dual-network). ADNet is designed to handle varying levels of motion blur by dynamically routing images between two specialized networks.
1. EG-Restormer: Edge-Guided Restoration
For severely blurred images, we developed the EG-Restormer. Its core innovation is the Edge-Guided Attention Block (EGAB). Unlike standard self-attention, EGAB incorporates an Edge-Guided Attention (EGA) module. This module utilizes Sobel operators to detect edges in four primary directions (0°, 45°, 90°, and 135°). By explicitly injecting these edge maps into the attention mechanism, the model is forced to focus on restoring the sharp boundaries critical for successful decoding.
2. LENet: Lightweight and Efficient Network
Not every blurred image requires a massive Transformer. For mildly blurred QR codes, we introduce LENet, a CNN-based model with only 0.28M parameters. It utilizes a Simple Gate Depthwise Convolution Block (SGDB) for efficiency and an Edge Sharpening Attention Block (ESAB) to refine the output.
3. Adaptive Routing (BSR)
The Blur Severity-based Routing (BSR) unit acts as the system's brain. It calculates the Laplacian variance of the input image to estimate blur severity. If the blur is mild, the image is sent to LENet. If the decoder fails or the initial blur is severe, the image is routed to the more powerful EG-Restormer. This adaptive approach ensures high performance while minimizing latency.
Experimental Results
We evaluated our framework on a new synthetic dataset, QRData, and a real-world test set of motion-blurred QR codes.
- Decoding Rate (DR): EG-Restormer achieved a state-of-the-art decoding rate of 90%, significantly outperforming general-purpose models like NAFNet (81.33%).
- Efficiency: ADNet maintained the 90% decoding rate while reducing average inference time by 19% (from 0.910s to 0.737s) compared to using EG-Restormer alone.
- Metric Shift: Our results highlight that traditional metrics like PSNR do not always correlate with decodability. Models that prioritize edge restoration often achieve higher decoding rates even if their PSNR is slightly lower than "smoother" models.
Conclusion
ADNet demonstrates that explicitly incorporating domain-specific priors—like the sharp edges of QR codes—can lead to significant gains in functional restoration tasks. By combining a powerful edge-guided Transformer with a lightweight CNN and an intelligent router, we provide a solution that is both highly effective and efficient enough for real-world mobile deployment. Future work will explore extending these edge-guided priors to other structured domains such as text and facial recognition.
Summary updated