Skip to main content

Vision Xformers

Project description

ViX

PWC

Vision Xformers: Efficient Attention for Image Classification

image

We use Linear Attention mechanisms to replace quadratic attention in ViT for image classification. We show that models using linear attention and CNN embedding layers need less parameters and low GPU requirements for achieving good accuracy. These improvements can be used to democratize the use of transformers by practitioners who are limited by data and GPU.

Hybrid ViX uses convolutional layers instead of linear layer for generating embeddings

Rotary Postion Embedding (RoPE) is also used in our models instead of 1D learnable position embeddings

Nomenclature: We replace the X in ViX with the starting alphabet of the attention mechanism used Eg. When we use Performer in ViX, we replace the X with P, calling it ViP (Vision Performer)

'Hybrid' prefix is used in models which uses convolutional layers instead of linear embeddding layer.

We have added RoPE in the title of models which used Rotary Postion Embedding

The code for using all for these models for classification of CIFAR 10/Tiny ImageNet dataset is provided

Models

  • Vision Linformer (ViL)
  • Vision Performer (ViP)
  • Vision Nyströmformer (ViN)
  • FNet
  • Hybrid Vision Transformer (HybridViT)
  • Hybrid Vision Linformer (HybridViL)
  • Hybrid Vision Performer (HybridViP)
  • Hybrid Vision Nyströmformer (HybridViN)
  • Hybrid FNet
  • LeViN (Replacing Transformer in LeViT with Nyströmformer)
  • LeViP (Replacing Transformer in LeViT with Performer)
  • CvN (Replacing Transformer in CvT with Nyströmformer)
  • CvP (Replacing Transformer in CvT with Performer)
  • CCN (Replacing Transformer in CCT with Nyströmformer)
  • CCP(Replacing Transformer in CCT with Performer)

We have adapted the codes for ViT and linear transformers from @lucidrains

More information about these models can be obtained from our paper : ArXiv Paper, WACV 2022 Paper

If you wish to cite this, please use:

@misc{jeevan2021vision,
      title={Vision Xformers: Efficient Attention for Image Classification}, 
      author={Pranav Jeevan and Amit Sethi},
      year={2021},
      eprint={2107.02239},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
@InProceedings{Jeevan_2022_WACV,
    author    = {Jeevan, Pranav and Sethi, Amit},
    title     = {Resource-Efficient Hybrid X-Formers for Vision},
    booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
    month     = {January},
    year      = {2022},
    pages     = {2982-2990}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vision_xformer-0.1.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

vision_xformer-0.1.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file vision_xformer-0.1.1.tar.gz.

File metadata

  • Download URL: vision_xformer-0.1.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for vision_xformer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 783c0f2b90aad2ca2478c9fb484b484bc748fd5cbea1e010d972e5fce4f21ecd
MD5 c1d9da7ef4e4ad6ee28984f595995b44
BLAKE2b-256 17d6d7dcff109a953cd6834bfe9936e96e183d9b8e9744346b2b4f684fc11a16

See more details on using hashes here.

File details

Details for the file vision_xformer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for vision_xformer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90572a5fca4cc5e96f1c37b9e62f86c59652e1af2a76c2b0c2ffe06eb0899a69
MD5 3ed8de4acbf3a70e01e7082d836a68d2
BLAKE2b-256 2175fe3fd0c294fa85882d42264bad775e1595b66e38dfa2c2504b8fbb6da565

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page