Paper commentary
Restormer: Efficient Transformer for High-Resolution Image Restoration
Restormer uses efficient Transformer blocks for high-resolution image restoration
- Problem Standard Transformers scale quadratically with image size, so they are impractical for high-resolution image restoration. Earlier restoration Transformers avoided this by limiting attention to small local regions.
- Method Restormer applies attention across feature channels instead of across pixels, so its cost grows linearly with image size. It also gates feed-forward features with depth-wise convolutions inside a four-level encoder-decoder.
- Results Restormer reaches 33.96 dB average PSNR over five deraining test sets, against 32.91 dB for SPAIR.
Why self-attention is costly for restoration
CNN restoration models have a fixed local receptive field, and their filter weights stay static at inference, so they cannot adapt to input content or model distant pixels. Self-attention addresses both limits by forming each output as a weighted sum over all positions, but the cost of its key-query interaction grows with the square of spatial size.
Earlier restoration Transformers avoid this cost by restricting attention to local regions, either 8×8 neighbourhoods around each pixel or 48×48 patches processed independently. The authors argue that such restriction works against the aim of capturing true long-range relations, particularly in large images.
How the encoder-decoder is organized
A degraded image I of size H×W×3 is first mapped by one convolution to shallow features F0 with C channels. A four-level symmetric encoder-decoder then turns these into deep features Fd of size H×W×2C, with Transformer blocks at every level.
Going down the encoder reduces spatial size level by level and widens the channels, so the bottom latent features reach H/8×W/8×8C before the decoder rebuilds full resolution. Pixel-unshuffle handles downsampling and pixel-shuffle handles upsampling, and encoder features join decoder features through skip connections followed by a 1×1 convolution that halves the channels at all levels except the top one.
The Transformer blocks at level 1 mix low-level encoder features with high-level decoder features, which the authors credit with keeping fine structure and texture in the output. Deep features then pass through a refinement stage at full resolution, and one convolution produces a residual R that is added to the input, so the restored image is I plus R.
Channel-wise attention in MDTA
MDTA runs self-attention across channels instead of across pixels, so the attention map is a Ĉ×Ĉ transposed-attention map rather than a map over all spatial positions. Because the map size does not depend on the number of pixels, the cost of MDTA scales linearly with spatial size.
Before the covariance step, query, key and value are built with a 1×1 point-wise convolution that mixes channels at each pixel, followed by a 3×3 depth-wise convolution that mixes neighbouring positions within each channel. The convolutions are bias-free, which means the projections carry no bias terms.
The block computes \(\hat{X} = W_p\,\mathrm{Attention}(\hat{Q},\hat{K},\hat{V}) + X\), where \(\mathrm{Attention}(\hat{Q},\hat{K},\hat{V}) = \hat{V}\cdot\mathrm{Softmax}(\hat{K}\cdot\hat{Q}/\alpha)\). Here \(\hat{Q}\) and \(\hat{V}\) are ĤŴ×Ĉ matrices and \(\hat{K}\) is Ĉ×ĤŴ, so \(\hat{K}\cdot\hat{Q}\) is Ĉ×Ĉ, and α is a learnable scalar that controls the size of this dot product before the softmax.
As in multi-head attention, the channels are divided into heads that learn separate attention maps in parallel.
Gating in the feed-forward path
A standard feed-forward block applies two 1×1 convolutions with an expansion ratio γ, usually 4, and a non-linearity between them. GDFN keeps this layout but replaces the first layer with two parallel linear paths, one passed through GELU, and multiplies the two paths element-wise so that one path gates the other.
The gate lets the block decide which features continue through the network, which the authors connect to letting later layers focus on finer image attributes. Depth-wise convolutions are added in both paths so that the gate operates on spatially neighbouring information.
The block is written as \(\hat{X} = W_{0p}\,\mathrm{Gating}(X) + X\), with \(\mathrm{Gating}(X) = \phi\big(W_{1d}W_{1p}(\mathrm{LN}(X))\big)\odot W_{2d}W_{2p}(\mathrm{LN}(X))\), where φ is GELU, ⊙ is element-wise multiplication and LN is layer normalization. Because GDFN does more operations than a standard feed-forward block, its expansion ratio is lowered so that parameters and compute stay similar, and the setting used is γ=2.66.
Growing patch size during training
The authors argue that a Transformer trained only on small crops may not learn global image statistics, which would hurt results on full-resolution test images. Progressive learning starts with small patches and large batches, and later uses larger patches with smaller batches, a schedule similar to curriculum learning.
Batch size shrinks as patch size grows so that each optimization step takes about as long as in fixed-patch training.
Training time was 23.1 h for the progressive schedule and 22.5 h for fixed patches, so the two runs were close in cost.
Training configuration
Separate models are trained for each image restoration task, and unless noted otherwise the same training parameters are used. The model uses Transformer block counts of [4, 6, 6, 8] from level 1 to level 4, MDTA head counts of [1, 2, 4, 8], channel counts of [48, 96, 192, 384], and a refinement stage of 4 blocks.
Training uses the AdamW optimizer with β1=0.9, β2=0.999 and weight decay 1e−4, with L1 loss for 300K iterations. The learning rate starts at 3e−4 and is reduced to 1e−6 with cosine annealing, and training uses horizontal and vertical flips for augmentation.
Deraining and motion deblurring results
Deraining scores use PSNR and SSIM computed on the Y channel of YCbCr. Averaged over the five deraining test sets, Restormer reaches 33.96 dB PSNR, against 32.91 dB for SPAIR, which the authors call the recent best method in that comparison. That is a 1.05 dB average gain, and the gain on Rain100L reaches 2.06 dB.
For motion deblurring, Restormer is trained only on GoPro and then applied to HIDE and RealBlur without retraining. Its scores are 32.92 on GoPro, 31.22 on HIDE, 36.19 on RealBlur-R and 28.96 on RealBlur-J, all in PSNR. Averaged over the datasets, it is 0.47 dB above MIMO-UNet+ and 0.26 dB above MPRNet.
Compared with MPRNet, Restormer has 81% fewer FLOPs. Against IPT, the authors report a 0.4 dB gain with 4.4× fewer parameters and a 29× faster run.
Defocus deblurring results
All defocus scores are on the DPDD test set, split into indoor, outdoor and combined scene categories. RestormerS, the single-image variant, reaches 25.98 dB PSNR on the combined category, and RestormerD, the dual-pixel variant, reaches 26.66 dB.
On the combined category, the authors report about 0.6 dB above IFAN and a 1.01 dB PSNR gain over Uformer. The IFAN dual-pixel entry in the same table reaches 25.99 dB, so the margin to the next best entry is the number the authors describe in the text.
Denoising results
Gaussian denoising is tested at noise levels 15, 25 and 50, under two settings: one model for all noise levels and one model per noise level. In the single-model setting, Restormer reaches 28.33 dB on Urban100 at noise level 50, which is 0.37 dB above DRUNet at 27.96 dB. In the per-level setting, Restormer reaches 28.29 dB on the same case, which is 0.31 dB above SwinIR at 27.98 dB.
DRUNet needs a noise-level map as an extra input, whereas Restormer takes only the noisy image. Compared with SwinIR, Restormer has 3.14× fewer FLOPs and runs 13× faster. Denoising uses a bias-free Restormer, following earlier denoising work.
On real image denoising, Restormer is trained only on the SIDD images and tested directly on DND. It scores 40.02 dB PSNR on SIDD and 40.03 dB on DND, and it is the only compared method above 40 dB on both. On SIDD it is 0.3 dB above MIRNet and 0.25 dB above Uformer.
What the ablations isolate
FLOPs and inference time are measured on 256×256 images.
The baseline is a UNet with residual blocks, at 29.11 dB PSNR, and replacing its attention with MDTA and a standard feed-forward network reaches 29.43 dB, a 0.32 dB gain. Removing the depth-wise convolution from MDTA drops the result to 29.28 dB, so locality inside the attention matters in these runs.
The full GDFN variant adds 0.26 dB over the standard feed-forward network at noise level 50, and the full Transformer block configuration reaches 29.62 dB, a 0.51 dB gain over the baseline.
At level 1, leaving out the 1×1 convolution after concatenation raises PSNR from 29.62 to 29.66 dB, and adding the refinement stage raises it to 29.71 dB. Under similar parameter and FLOP budgets, the deep-narrow model with dim 48 reaches 29.71 dB and the wide model with dim 80 reaches 29.56 dB, while the wider model trains and tests faster, 13.5 h against 22.5 h and 0.069 s against 0.115 s.
Limitations
Each task uses its own separately trained model, and motion deblurring is trained only on GoPro with the other datasets used for generalization checks.
The FLOP and inference-time figures in the ablations are measured on 256×256 images, and the main-text speed comparisons do not state an image size.
Paper info
- Authors
- Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, Ming-Hsuan Yang
- Venue
- arXiv · Preprint
- First published
- 2021-11-18
- Added
- 2026-11-12
- Updated
- 2022-3-11
- Version
- v2
- arXiv
- 2111.09881
- Category
- cs.CV
- Original paper terms
- CC BY-NC-SA 4.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, Ming-Hsuan Yang (2021). Restormer: Efficient Transformer for High-Resolution Image Restoration. arXiv:2111.09881v2. https://arxiv.org/abs/2111.09881v2
BibTeX
@misc{zamir2021restormer,
title = {{Restormer: Efficient Transformer for High-Resolution Image Restoration}},
author = {Syed Waqas Zamir and Aditya Arora and Salman Khan and Munawar Hayat and Fahad Shahbaz Khan and Ming-Hsuan Yang},
year = {2021},
eprint = {2111.09881},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2111.09881v2}
}