Home

Awesome

Super Vision Transformer (Link)

Pytorch implementation of our paper "Super Vision Transformer", accepted by International Journal of Computer Vision (IJCV)

Introduction

<div align=center><img src="supervit.png" height = "60%" width = "70%"/></div>

We present a novel training paradigm that trains only one ViT model at a time, but is capable of providing improved image recognition performance with various computational costs. Here, the trained ViT model, termed super vision transformer (SuperViT), is empowered with the versatile ability of solving incoming patches of multiple sizes as well as preserving informative tokens with multiple keeping rates (the probability of keeping tokens) to achieve a good hardware efficiency for inference.

Pre-trained Models

SuperViT(DeiT-S)

token number\keep ratio0.50.71
8x873.7575.2875.79
10x1077.3278.3178.53
12x1278.9179.6279.87
14x1479.9580.5080.62

SuperViT(LV-ViT-S)

token number\keep ratio0.50.71
8x876.6479.8280.71
10x1079.8181.7382.24
12x1281.1282.5982.94
14x1482.1183.1583.47

Requirements

Data Preparation

ImageNet
├── train
│   ├── folder 1 (class 1)
│   ├── folder 2 (class 1)
│   ├── ...
├── val
│   ├── folder 1 (class 1)
│   ├── folder 2 (class 1)
│   ├── ...

Evaluate Pre-trained Models

python -m torch.distributed.launch --nproc_per_node=4 main_deit.py  --model super_deit_s --batch-size 256 --data-path PATH_TO_IMAGENET --dist-eval --output PATH_TO_LOG --eval --resume PATH_TO_CHECKPOINTS
python -m torch.distributed.launch --nproc_per_node=4 main_lvvit.py PATH_TO_IMAGENET --model super_lvvit_s -b 256 --native-amp --drop-path 0.1 --token-label --token-label-data PATH_TO_TOKENLABEL --token-label-size 14 --model-ema --output PATH_TO_LOG --eval --resume PATH_TO_CHECKPOINTS

Train

python -m torch.distributed.launch --nproc_per_node=4 main_deit.py  --model super_deit_s --batch-size 256 --data-path PATH_TO_IMAGENET --dist-eval --output PATH_TO_LOG
python -m torch.distributed.launch --nproc_per_node=4 main_lvvit.py PATH_TO_IMAGENET --model super_lvvit_s -b 256 --native-amp --drop-path 0.1 --token-label --token-label-data PATH_TO_TOKENLABEL --token-label-size 14 --model-ema --output PATH_TO_LOG

Acknowledgment

Our code of LV-ViT is from here. Our code of DeiT is from here.

Contact

First author: lmb001@outlook.com; Second author: cmzxmu@stu.xmu.edu.cn