
naflexvit_base_patch16_parfac_gap
Image classification369 ops86.5M params
A Vision Transformer with NaFlex support for variable aspect ratio, resolution and patch size.
Image classification · 360 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
timm.create_model('naflexvit_base_patch16_par_gap', pretrained=False) This model is a ViT-Base with NaFlex functionality, an aspect-preserving position embedding and global average pooling.
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.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.