All models

twins_pcpvt_base

A vision transformer backbone from the Twins pair, built around efficient spatial attention.

Image classification · 907 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

Loading diagram (48 KB)

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

Family
Twins
Parameters
43.8M
Operations
907
Framework
PyTorch
Recurrent
No
Published
2021
License
Apache-2.0
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
m10721
Graph hash
508df7fe3d8ec7b33de973de88633b54223277b8e8956054f1374df3bf1dbc66
Skeleton hash
935a9da17cdac3ee069dd1a8859541e7fc71a8926c0ed2894290e9a83f1e76ab
Architecture hash
16d7030d7d8cc86ed21b83d6a977fd52d6bd6995b123987aab9ee011d124e48f
Diagram SHA-256
4138f7fc2690bd999204b9f288a9d3a8f41404b6ad0c78110f229e89da470b12
TorchLens version
2.35.3
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

timm.create_model('twins_pcpvt_base', pretrained=False)

What it is

This model is the base size of Twins-PCPVT, the design built on PVT and CPVT that uses only global attention.

About this model's family

Twins is a pair of vision transformer architectures, Twins-PCPVT and Twins-SVT, that came out of a study of how spatial attention should be designed. The paper presents both as backbones for image classification as well as dense detection and segmentation.

Twins-PCPVT is built on PVT and CPVT and uses only global attention. It replaces the absolute positional encoding of PVT with the conditional position encoding from CPVT, produced by a 2D depth-wise convolution placed after the first encoder block of each stage. Twins-SVT uses spatially separable self-attention, which pairs locally-grouped self-attention for fine-grained, short-distance information with global sub-sampled attention for long-distance and global information. The authors named this attention after separable depthwise convolutions.

On ImageNet-1K the paper reports that Twins-PCPVT-S outperforms PVT-small by 1.4% and obtains a result similar to Swin-T with 18% fewer FLOPs, and that Twins-SVT-S is better than Swin-T with about 35% fewer FLOPs.

Key idea. Twins revisits spatial attention in vision transformers and proposes two architectures, Twins-PCPVT and Twins-SVT, whose attention involves only matrix multiplications.

  • Twins
  • Twins-PCPVT
  • Twins-SVT
  • spatially separable self-attention
  • SSSA
  • spatial attention
  • vision transformer backbone
  • image classification
  • conditional position encoding

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