MaxViT
17 memberslucid.models.vision.maxvitMaxViT — Multi-Axis Vision Transformer (Tu et al., 2022).
Tu, Zhengzhong, et al. "MaxViT: Multi-Axis Vision Transformer." Proceedings of the European Conference on Computer Vision, 2022, pp. 459-479.
MaxViT combines a convolutional MBConv stage with two complementary sparse self-attention mechanisms — block attention and grid attention — to obtain global receptive fields at linear complexity in the number of tokens. The backbone is a four-stage pyramid, and each stage stacks repeats of the MaxViT block consisting of a MobileNetV3-style MBConv followed by block and then grid attention.
Given a feature map of shape , block attention partitions it into non-overlapping windows (default ) and runs full self-attention within each window — identical to Swin's W-MSA. Grid attention takes the same feature map and reshapes it into a dilated grid: tokens that share the same intra-window position across all windows are gathered into a single attention group. Formally, if we tile the spatial dimensions as , , block attention groups along the axis and grid attention groups along the axis:
Together the two operations realise dense local plus dense global self-attention, but each individual attention call has cost per token, giving overall complexity. Variants Tiny / Small / Base / Large simply scale stage depths and channel widths along this shared multi-axis attention design.
Classes
Functions
maxvit_tiny→ MaxViTMaxViT-Tiny backbone (Tu et al., 2022).
maxvit_tiny_cls→ MaxViTForImageClassificationMaxViT-Tiny image classifier (Tu et al., 2022).
maxvit_small→ MaxViTMaxViT-Small backbone (Tu et al., 2022).
maxvit_small_cls→ MaxViTForImageClassificationMaxViT-Small image classifier (Tu et al., 2022).
maxvit_base→ MaxViTMaxViT-Base backbone (Tu et al., 2022).
maxvit_base_cls→ MaxViTForImageClassificationMaxViT-Base image classifier (Tu et al., 2022).
maxvit_large→ MaxViTMaxViT-Large backbone (Tu et al., 2022).
maxvit_large_cls→ MaxViTForImageClassificationMaxViT-Large image classifier (Tu et al., 2022).
maxvit_xlarge→ MaxViTMaxViT-XLarge backbone (Tu et al., 2022).
maxvit_xlarge_cls→ MaxViTForImageClassificationMaxViT-XLarge image classifier (Tu et al., 2022).
Weights
MaxViTBaseWeightsPretrained weights for lucid.models.maxvit_base_cls.
MaxViTLargeWeightsPretrained weights for lucid.models.maxvit_large_cls.
MaxViTSmallWeightsPretrained weights for lucid.models.maxvit_small_cls.
MaxViTTinyWeightsPretrained weights for lucid.models.maxvit_tiny_cls.