
uformer_tiny_b16
262 ops145.4K params
The Base Uformer: a UNet whose convolutions became window-attention Transformer blocks, for image restoration.
262 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.
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.
How this diagram was made
menagerie.classics.uformer:build_uformer_b: build({}) Uformer is a Transformer-based architecture for image restoration, the classic task of recovering a clean image from a degraded one. The degradations in question are the everyday ones: noise, blur, rain and so on. The shape is borrowed straight from UNet: the convolution layers are swapped for Transformer blocks while the hierarchical encoder-decoder and its skip connections stay put. The motivation is that the state-of-the-art ConvNet restorers of the time achieved impressive results but struggled with long-range dependencies.
The basic unit is the Locally-enhanced Window (LeWin) Transformer block, which runs self-attention inside non-overlapping windows instead of across the whole image. Because the window size stays fixed while the feature maps shrink down the hierarchy, attention at low resolution sees far more of the image. Local context, which restoration leans on heavily, comes from a depth-wise convolution slipped between the two fully-connected layers of the feed-forward network. Ablations found that locality belongs in the feed-forward path rather than in the attention: adding it to self-attention actually cost 0.02 dB on SIDD. The second design is a multi-scale restoration modulator: a learnable window-based tensor added to the features in each decoder LeWin block to help recover detail. It acts as a shared bias term added to all windows before self-attention, costing marginal parameters and compute. The network predicts a residual image that is added back to the input, trained with a Charbonnier loss.
The member captured here is the Base variant, Uformer-B, with C = 32 channels and encoder depths of {1, 2, 8, 8}. The decoder depths mirror the encoder's. Windows are 8 × 8 throughout and there are 4 encoder and decoder stages by default. On SIDD denoising Uformer-B reaches 39.89 dB PSNR, at least 0.14 dB above every other method. On DND it edges the previous state of the art, NBNet, by 0.09 dB. For motion deblurring, trained only on GoPro, it generalises to real blur, beating others by at least 0.23 dB on RealBlur-R and 0.36 dB on RealBlur-J. The biggest jump is deraining on SPAD: 47.84 dB, 3.74 dB over the previous best. Swapping the LeWin blocks for convolutional ResBlocks gives a plain UNet, and Uformer-B beats its UNet-B counterpart by 0.18 dB.
Key idea. Uformer swaps UNet's convolutions for locally-enhanced window Transformer blocks and adds a learnable multi-scale bias to the decoder, giving a restoration network that captures both local and global dependencies at modest cost.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{wang2021uformergeneralushapedtransformer,
title={Uformer: A General U-Shaped Transformer for Image Restoration},
author={Zhendong Wang and Xiaodong Cun and Jianmin Bao and Wengang Zhou and Jianzhuang Liu and Houqiang Li},
year={2021},
eprint={2106.03106},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2106.03106},
}