keras-io / shiftvit

huggingface.co
Total runs: 10
24-hour runs: 0
7-day runs: -7
30-day runs: -2
Model's Last Updated: July 05 2024
image-classification

Introduction of shiftvit

Model Details of shiftvit

Model description

ShiftViT is a variation of the Vision Transformer (ViT) where the attention operation has been replaced with a shifting operation.

ShiftViT model was proposed as part of the paper When Shift Operation Meets Vision Transformer: An Extremely Simple Alternative to Attention Mechanism . Vision Transformers have lately become very popular for computer vision problems and a lot researchers attribute their success to the attention layers. The authors of the ShiftViT paper have tried to show via the ShiftViT model that even without the attention operation, ViTs can reach SoTA results.

Model Architecture

The architecture for ShiftViT is inspired by the paper Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

Here the authors propose a modular architecture with 4 stages. Each stage works on its own spatial size, creating a hierarchical architecture.

ShiftViT Architecture
Figure 1: The entire architecutre of ShiftViT.
Source

Each stage in the ShiftViT architecture comprises of a Shift Block as shown in Fig 2.

ShiftViT block
Figure 2: From the Model to a Shift Block.

The Shift Block as shown in Fig. 2, comprises of the following:

  • Shift Operation
  • Linear Normalization
  • MLP Layer: stack of densely-connected layers

How shift operation works:

  1. Split the channels
  2. Select each of the first four spilts and shift and pad them in the respective directions.
  3. After shifting and padding, we concatenate the channel back.
Manim rendered animation for shift operation
Figure 3: The TensorFlow style shifting
Intended uses

This ShiftViT model is trained to be used for image classification task.

However, the ShiftViT architecture can be used for a variety of visual recognition tasks. The authors of the ShiftViT paper tested the model on the following tasks:

  • Image Classification on ImageNet-1k dataset
  • Object Detection on COCO dataset
  • Semantic Segmentation on ADE20k dataset
Training and evaluation data

The dataset used for training the model is CIFAR-10. The CIFAR-10 dataset is a popular dataset used for image classification. It contains images belonging to the following 10 classes:

Classes
airplane
automobile
bird
cat
deer
dog
frog
horse
ship
truck

No. of samples used for training and evaluation are:

  • Training samples: 40000
  • Validation samples: 10000
  • Testing samples: 10000
Training procedure
  1. Data Preparation:
  • Data Augmentation: The augmentation steps used for data preparation include: rescaling, resizing, cropping and horizontal flipping.
  1. Building the ShiftViT Model:
  • The steps for constructing the ShiftViT model have been covered extensively in this Keras example
  1. Model Training:

The model is then trained using the following config:

Training Config Value
Optimizer Adam
Loss Function sparse_categorical_crossentropy
Metric Accuracy
Epochs 5
  1. Model Testing:

The model is tested on the test data post training achieving an accuracy of ~90%.

Training hyperparameters

The following hyperparameters were used during training:

Hyperparameters Value
name AdamW
learning_rate.class_name WarmUpCosine
learning_rate.config.lr_start 1e-05
learning_rate.config.lr_max 0.001
learning_rate.config.total_steps 312
learning_rate.config.warmup_steps 46
decay 0.0
beta_1 0.8999999761581421
beta_2 0.9990000128746033
epsilon 1e-07
amsgrad False
weight_decay 9.999999747378752e-05
exclude_from_weight_decay None
training_precision float32
Model Plot
View Model Plot

Model Image

Credits:

Runs of keras-io shiftvit on huggingface.co

10
Total runs
0
24-hour runs
0
3-day runs
-7
7-day runs
-2
30-day runs

More Information About shiftvit huggingface.co Model

shiftvit huggingface.co

shiftvit huggingface.co is an AI model on huggingface.co that provides shiftvit's model effect (), which can be used instantly with this keras-io shiftvit model. huggingface.co supports a free trial of the shiftvit model, and also provides paid use of the shiftvit. Support call shiftvit model through api, including Node.js, Python, http.

keras-io shiftvit online free

shiftvit huggingface.co is an online trial and call api platform, which integrates shiftvit's modeling effects, including api services, and provides a free online trial of shiftvit, you can try shiftvit online for free by clicking the link below.

keras-io shiftvit online free url in huggingface.co:

https://huggingface.co/keras-io/shiftvit

shiftvit install

shiftvit is an open source model from GitHub that offers a free installation service, and any user can find shiftvit on GitHub to install. At the same time, huggingface.co provides the effect of shiftvit install, users can directly use shiftvit installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

shiftvit install url in huggingface.co:

https://huggingface.co/keras-io/shiftvit

Url of shiftvit

shiftvit huggingface.co Url

Provider of shiftvit huggingface.co

keras-io
ORGANIZATIONS

Other API from keras-io

huggingface.co

Total runs: 14
Run Growth: 5
Growth Rate: 45.45%
Updated:July 05 2024
huggingface.co

Total runs: 14
Run Growth: 1
Growth Rate: 7.69%
Updated:July 05 2024
huggingface.co

Total runs: 14
Run Growth: 3
Growth Rate: 20.00%
Updated:July 05 2024
huggingface.co

Total runs: 13
Run Growth: 0
Growth Rate: 0.00%
Updated:July 05 2024
huggingface.co

Total runs: 13
Run Growth: -2
Growth Rate: -15.38%
Updated:May 23 2025
huggingface.co

Total runs: 11
Run Growth: -14
Growth Rate: -127.27%
Updated:July 05 2024
huggingface.co

Total runs: 9
Run Growth: -4
Growth Rate: -44.44%
Updated:July 05 2024
huggingface.co

Total runs: 8
Run Growth: 2
Growth Rate: 25.00%
Updated:July 05 2024
huggingface.co

Total runs: 8
Run Growth: 2
Growth Rate: 28.57%
Updated:February 16 2022
huggingface.co

Total runs: 8
Run Growth: -7
Growth Rate: -87.50%
Updated:July 05 2024
huggingface.co

Total runs: 8
Run Growth: -3
Growth Rate: -37.50%
Updated:January 13 2022
huggingface.co

Total runs: 7
Run Growth: 0
Growth Rate: 0.00%
Updated:August 15 2022
huggingface.co

Total runs: 7
Run Growth: 4
Growth Rate: 57.14%
Updated:February 06 2022
huggingface.co

Total runs: 6
Run Growth: 6
Growth Rate: 85.71%
Updated:March 01 2022
huggingface.co

Total runs: 6
Run Growth: 1
Growth Rate: 20.00%
Updated:July 05 2024
huggingface.co

Total runs: 5
Run Growth: -6
Growth Rate: -150.00%
Updated:February 18 2022
huggingface.co

Total runs: 4
Run Growth: -9
Growth Rate: -225.00%
Updated:February 04 2022
huggingface.co

Total runs: 4
Run Growth: -9
Growth Rate: -225.00%
Updated:July 05 2024
huggingface.co

Total runs: 3
Run Growth: 0
Growth Rate: 0.00%
Updated:February 23 2022
huggingface.co

Total runs: 2
Run Growth: -7
Growth Rate: -350.00%
Updated:July 05 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:August 12 2023