monai.Restormer
Image restoration Transformer that attends across channels instead of pixels so it can run on full-size images.
Diffusion and generative · 1,706 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 26.1M
- Operations
- 1,706
- Framework
- PyTorch
- Recurrent
- No
- Published
- CVPR 2022
- Cited by
- 4,349 (as of 18 October 2026)
- Authors
- Syed Waqas Zamir, Aditya Arora, Salman Khan and others
- Source
- mmagic 1.2.0
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m7445
- Graph hash
- 84ca79b938a3c1efe98fd4fda31be27d7de548b3400e888cd76f09e6b1beb5af
- Skeleton hash
- 529372969ff566b817f02f9342f0512fb269670cc297e6de14d9e590d565c0cf
- Architecture hash
- 2d58ff218373786f5ae62a728952908e896f31df922197ca3cb33975bd93e482
- Diagram SHA-256
- 42ddcc0feb447bd78ec955fb3d7998bdb2892b646a69c3e2e808f36aa206e297
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
How this diagram was made
monai.networks.nets.restormer.Restormer(spatial_dims=2, in_channels=3, out_channels=3, dim=48, num_blocks=[4, 6, 6, 8], heads=[1, 2, 4, 8], num_refinement_blocks=4, ffn_expansion_factor=2.66, bias=False, layer_norm_use_bias=True, dual_pixel_task=False, flash_attention=False)
What it is
MONAI's 2D port, built here with the paper's own configuration of [4, 6, 6, 8] Transformer blocks, [1, 2, 4, 8] attention heads and 48 base channels.
Restormer, the Restoration Transformer, is an image restoration network built for deraining, motion and defocus deblurring, and denoising. The problem it solves is one of scale: the Transformer fixes the limited receptive field and inadaptability to input content of CNNs, but its computational complexity grows quadratically with spatial resolution, making it infeasible for most restoration tasks on high-resolution images. Earlier attempts restricted the spatial extent of self-attention, which the authors argue is contradictory to the goal of capturing the true long-range pixel relationships.
Restormer's answer is multi-Dconv head transposed attention, MDTA, which applies self-attention across the feature dimension rather than the spatial one and so has linear complexity. Instead of modelling pairwise pixel interactions, MDTA computes cross-covariance across feature channels to obtain the attention map. Before that covariance step, 1×1 convolutions mix cross-channel context pixel-wise and depth-wise convolutions aggregate local context channel-wise. The feed-forward block is reworked too: a gated-Dconv feed-forward network, GDFN, forms the element-wise product of two linear projections, one passed through GELU, to control which features flow forward. These blocks sit inside a 4-level encoder-decoder. The deep features are then further enriched in a refinement stage operating at high spatial resolution.
Training is progressive: the network starts on small patches with large batches and moves to gradually larger patches and smaller batches in later epochs. The paper's configuration uses [4, 6, 6, 8] Transformer blocks from level-1 to level-4, with [1, 2, 4, 8] attention heads and channels [48, 96, 192, 384]. The refinement stage contains 4 blocks and the GDFN channel expansion factor is 2.66. Averaged over the motion deblurring datasets, it gains 0.26 dB over the previous best method MPRNet. Compared to MPRNet, Restormer has 81% fewer FLOPs. On real image denoising, among competing approaches only Restormer surpasses 40 dB PSNR.
Key idea. Restormer makes a Transformer practical for high-resolution restoration by redesigning multi-head attention and the feed-forward network so it can capture long-range pixel interactions while still remaining applicable to large images.
- Restormer
- Restoration Transformer
- image restoration
- deraining
- deblurring
- denoising
- MDTA
- GDFN
- efficient transformer
- MONAI Restormer
- mmagic restormer
- swz30/Restormer
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{zamir2022restormerefficienttransformerhighresolution,
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={2022},
eprint={2111.09881},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2111.09881},
}