All models

naflexvit_so150m2_patch16_reg1_gap

A Vision Transformer with NaFlex support for variable aspect ratio, resolution and patch size.

Image classification · 612 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 (14 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

Parameters
136.1M
Operations
612
Framework
PyTorch
Recurrent
No
Published
2024
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
m7556
Graph hash
e345b830fdadb712d5d6c159a2f5bae599b63e36906ea71a669c46089839ed31
Skeleton hash
5e402f477ba3d7b9ea4b52a2af95009b19964f49cf64cd2a17923941addeeacf
Architecture hash
c76d2f53c72451d7dffcf30886ca2f0cf07c0384b2d8068c3a4a8d9fe62ab9a0
Diagram SHA-256
b5753ceb4542c515365adaa3b098579fd2e13dd1e6d9e9bd8723a3e0b5dec229
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('naflexvit_so150m2_patch16_reg1_gap', pretrained=False)

What it is

This model is a ViT-SO150M2 with NaFlex functionality for variable aspect ratios and resolutions.

About this model's family

NaFlexViT is the NaFlex Vision Transformer in the timm library, described there as an improved version of the Vision Transformer. It encapsulates embedding and position encoding in a single module, and it supports NaFlex inputs of variable aspect ratio and resolution. It also supports the variable patch size of FlexiViT and the fractional or factorized position embedding of NaViT.

The underlying design comes from the original Vision Transformer paper, which splits an image into fixed-size patches, linearly embeds each one, adds position embeddings and feeds the resulting sequence to a standard Transformer encoder. That paper reports that, when pre-trained on large amounts of data, the Vision Transformer compared well with the convolutional networks of its time while requiring substantially fewer computational resources to train.

The base-size models differ in pooling and position embedding: global average pooling or MAP attention pooling, with aspect-preserving and factorized position embeddings as options. The description of the SO150M2 model adds that it uses explicit patch coordinates and valid token masking.

Key idea. NaFlexViT extends the Vision Transformer with a single embedding and position-encoding module that supports variable aspect ratio, resolution and patch size.

  • naflexvit
  • naflex vision transformer
  • naflex
  • variable aspect ratio
  • variable resolution
  • variable patch size
  • factorized position embedding
  • image classification

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