Home

Awesome

<h1 align="center">[TPAMI 2024] Pruning Self-attentions into Convolutional Layers in Single Path</h1>

This is the official repository for our paper: Pruning Self-attentions into Convolutional Layers in Single Path by Haoyu He, Jianfei Cai, Jing liu, Zizheng Pan, Jing Zhang, Dacheng Tao and Bohan Zhuang.


<h3><strong><i>🚀 News</i></strong></h3>

[2023-12-29]: Accepted by TPAMI!

[2023-06-09]: Update distillation configurations and pre-trained checkpoints.

[2021-12-04]: Release pre-trained models.

[2021-11-25]: Release code.


Introduction:

To reduce the massive computational resource consumption for ViTs and add convolutional inductive bias, our SPViT prunes pre-trained ViT models into accurate and compact hybrid models by pruning self-attentions into convolutional layers. Thanks to the proposed weight-sharing scheme between self-attention and convolutional layers that cast the search problem as finding which subset of parameters to use, our SPViT has significantly reduced search cost.


Experimental results:

We provide experimental results and pre-trained models for SPViT:

NameAcc@1Acc@5# parametersFLOPsModel
SPViT-DeiT-Ti70.790.34.9M1.0GModel
SPViT-DeiT-Ti*73.291.44.9M1.0GModel
SPViT-DeiT-S78.394.316.4M3.3GModel
SPViT-DeiT-S*80.395.116.4M3.3GModel
SPViT-DeiT-B81.595.746.2M8.3GModel
SPViT-DeiT-B*82.496.146.2M8.3GModel
NameAcc@1Acc@5# parametersFLOPsModel
SPViT-Swin-Ti80.194.926.3M3.3GModel
SPViT-Swin-Ti*81.095.326.3M3.3GModel
SPViT-Swin-S82.496.039.2M6.1GModel
SPViT-Swin-S*83.096.439.2M6.1GModel

* indicates knowledge distillation.

Getting started:

In this repository, we provide code for pruning two representative ViT models.


If you find our paper useful, please consider cite:

@article{he2024Pruning,
  title={Pruning Self-attentions into Convolutional Layers in Single Path},
  author={He, Haoyu and Liu, Jing and Pan, Zizheng and Cai, Jianfei and Zhang, Jing and Tao, Dacheng and Zhuang, Bohan},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
  year={2024},
  publisher={IEEE}
}