All models

mlp_mixer (MMPretrain)

An MLP-Mixer image classifier built only from MLPs applied across image patches and across channels.

Image classification · 34 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 (42 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
541.8K
Operations
34
Framework
PyTorch
Recurrent
No
Source
timm 1.0.30
Name in source
mmpretrain:mlp_mixer
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
m6982
Graph hash
691c81822bac4f605fa1c883e508bda99991b55c3be9098109db3c12360eb214
Skeleton hash
5ff2b6ed298ed6c38bd74b28d60430fd0f4911e5a75c83456be848e01629be3f
Architecture hash
e77a314d7c01a623dc03b926f7ee716c5426aa62fa502c5265a24b1e9f541ee4
Diagram SHA-256
d6308000e69ef2132f98e97ac72980ddb78a122a58776797303faeebd2211de5
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

menagerie.classics.wave_b_openmmlab:build_mmpretrain: build({})

What it is

About this model's family

MLP-Mixer is an image classification architecture based exclusively on multi-layer perceptrons (MLPs): it does not use convolutions or self-attention. The paper's claim is that convolutions and attention are both sufficient for good performance, but that neither is necessary.

The model takes a sequence of linearly projected image patches, arranged as a table of patches by channels, and keeps that shape through the network. Each Mixer layer contains two MLPs: a token-mixing MLP that lets different spatial locations communicate, and a channel-mixing MLP that lets different channels communicate. The other components are standard ones, skip-connections and layer normalization, and unlike ViT the model has no position embeddings, because the token-mixing MLPs are sensitive to the order of the input tokens. The classification head is a global average pooling layer followed by a linear classifier.

The paper notes that the network's computational complexity is linear in the number of input patches, unlike ViT, whose complexity is quadratic. It reports 87.94% top-1 validation accuracy on ILSVRC2012 ImageNet after pre-training on large datasets. With pre-training data of more modest scale, the paper says that Mixer, similar to ViT, falls slightly short of specialized CNN architectures.

Key idea. MLP-Mixer shows that an architecture based exclusively on multi-layer perceptrons, without convolutions or attention, attains competitive scores on image classification benchmarks.

  • mlp-mixer
  • mlp mixer
  • mixer
  • all-mlp architecture
  • image classification
  • token-mixing mlp
  • channel-mixing mlp
  • attention-free vision model

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