All models

DRSformer

Image deraining Transformer whose attention keeps only the top-k scores for each query.

Diffusion and generative · 4,942 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

This diagram has 4,942 operations (35 KB) and is drawn when you ask.

Open in a new tab

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
33.7M
Operations
4,942
Framework
PyTorch
Recurrent
No
Published
CVPR 2023
Cited by
570 (as of 27 October 2026)
Authors
Xiang Chen, Hao Li, Mingqiang Li, Jinshan Pan
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m15746
Graph hash
dd3547cc970a8a1662dec00896e6d543aa9aeb23ae31c2d72bf04e2333698e15
Skeleton hash
41517a17d88a6dbb1e2d0379d3f736007e45a89f3ea7ff9c98bbb80d997631d8
Architecture hash
49ea7db213def93e1c689349b76aac7d75ce26488b17f3c645fa6a4cb435c3da
Diagram SHA-256
e7182c5b3e8aea090c0d3dc4f26b43f9013a8d0a96bc406a8934eb1d69cc206c
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

What it is

DRSformer is a sparse Transformer network for image deraining. The paper starts from the observation that standard Transformers aggregate features using every query-key attention relation, and argues that scores from keys unrelated to the query interfere with restoring the clear image. DRSformer keeps only the largest similarity scores between queries and keys, chosen by a learnable top-k selection operator, and sets the remaining entries to 0 before the softmax.

The network is a hierarchical encoder-decoder with skip connections, and the final result is the network output added to the rainy input. Its building unit is the sparse Transformer block, which pairs top-k sparse attention with a mixed-scale feed-forward network. The attention is computed across channels rather than spatial positions to reduce time and memory, and the feed-forward network runs 3×3 and 5×5 depth-wise convolutions in two parallel branches to extract multi-scale local information. A mixture of experts feature compensator adds parallel CNN operations, called experts, at the early and final stages of the model.

The paper sets the initial channel width to 48, with 1, 2, 4 and 8 attention heads across the four levels and 8 experts per compensator. The authors do not use the compensator when training on Rain200L and SPA-Data, because the rain streaks in those datasets are less complex, and the repository keeps a separate architecture file for that case.

Key idea. DRSformer makes self-attention sparse with a learnable top-k selection operator that retains only the most useful attention scores for each query, and adds a mixed-scale feed-forward network for deraining.

  • drsformer
  • deraining sparse transformer
  • sparse transformer
  • image deraining
  • rain removal
  • top-k sparse attention
  • tksa
  • msfn
  • mefc

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{chen2023learningsparsetransformernetwork,
      title={Learning A Sparse Transformer Network for Effective Image Deraining}, 
      author={Xiang Chen and Hao Li and Mingqiang Li and Jinshan Pan},
      year={2023},
      eprint={2303.11950},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2303.11950}, 
}