Parameterization of Cross-Token Relations with Relative Positional Encoding for Vision MLP

Zhicai Wang, Yanbin Hao, Xingyu Gao, Hao Zhang, Shuo Wang +2 more
7/15/2022
cs.CVcs.AI

Official code: Zhicaiwww/PosMLP (8 stars, MIT, last commit 2023-03-16).

Abstract

Vision multi-layer perceptrons (MLPs) have shown promising performance in computer vision tasks, and become the main competitor of CNNs and vision Transformers. They use token-mixing layers to capture cross-token interactions, as opposed to the multi-head self-attention mechanism used by Transformers. However, the heavily parameterized token-mixing layers naturally lack mechanisms to capture local information and multi-granular non-local relations, thus their discriminative power is restrained. To tackle this issue, we propose a new positional spacial gating unit (PoSGU). It exploits the attention formulations used in the classical relative positional encoding (RPE), to efficiently encode the cross-token relations for token mixing. It can successfully reduce the current quadratic parameter complexity $O(N^2)$ of vision MLPs to $O(N)$ and $O(1)$. We experiment with two RPE mechanisms, and further propose a group-wise extension to improve their expressive power with the accomplishment of multi-granular contexts. These then serve as the key building blocks of a new type of vision MLP, referred to as PosMLP. We evaluate the effectiveness of the proposed approach by conducting thorough experiments, demonstrating an improved or comparable performance with reduced parameter complexity. For instance, for a model trained on ImageNet1K, we achieve a performance improvement from 72.14\% to 74.02\% and a learnable parameter reduction from $19.4M$ to $18.2M$. Code could be found at https://github.com/Zhicaiwww/PosMLP.

View on arXivView PDF

Code Implementations(1)

Zhicaiwww/PosMLPOfficial100%
MIT

Official implementation of ACMMM2022 paper "Parameterization of Cross-Token Relations with Relative Positional Encoding for Vsion MLP""

82PythonJul 16, 20223 years agoMIT

Cite this paper

@article{wang2022parameterization,
  title  = {Parameterization of Cross-Token Relations with Relative Positional Encoding for Vision MLP},
  author = {Zhicai Wang and Yanbin Hao and Xingyu Gao and Hao Zhang and Shuo Wang and Tingting Mu and Xiangnan He},
  year   = {2022},
  eprint = {2207.07284},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2207.07284v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2207.07284.svg)](https://codeofpaper.com/paper/2207.07284)

Discussion