In the past few years, Vision Transformer (ViT) has achieved excellent performance in the field of computer vision. However, there still some problems remain. For instance, ViTs heavily rely on large-scale training data since they simply contain a large number of trainable parameters, which slows down their learning efficiency and limits their applicability in resource-constrained scenarios. In this paper, we propose a novel deep learning model, namely All-Convolutional Self-Attention Network (ACSAN), which applies convolution operations to replace fully-connected matrices multiplications in the ViT framework. To implement ACSAN, we firstly design Dynamic Convolutional Self-Attention (DCSA) as the basic module, which employs multi-scale dilated convolutions to generate Query, Key, and Value. We defined spatial self-attention and channel self-attention to generate attention features respectively. The two attention features are finally merged as the output of the DCSA module. Based on DCSA, we then construct the basic ACSAN block. Comparing with ViT, we use DCSA to replace the regular self-attention operations, and use convolution layers to replace MLPs. To evaluate the performance of the proposed method, we train ACSAN on three widely-used image classification databases, i.e. CIFAR-10, CIFAR-100 and ImageNet-1k, from scratch. Experimental results show that ACSAN achieves excellent classification accuracy comparing with standard ViT with comparable or fewer parameters, as well as other state-of-the-art methods. Ablation studies verify that each component contributes positively to the final performance.
Figures & tables
Figure 1: Overall architecture of the proposed ACSAN model. The model consists of a convolution stem followed by multiple stages of DCSA Blocks with downsampling between stages.
Figure 2: Structure of the Dynamic Convolutional Self-Attention (DCSA) module. The DCSA module generates Q, K, V via multi-scale dilated convolutions, then applies parallel spatial and channel attention branches before fusion.
Figure 3: The structure of the proposed DCSA_Block module.
Stage
ACSAN_small
ACSAN_base
ACSAN_large
Stage 1
[Block] × 2, C =64
[Block] × 2, C =64
[Block] × 2, C =64
Stage 2
[Block] × 2, C =128
[Block] × 2, C =128
[Block] × 2, C =128
Stage 3
[Block] × 3, C =256
[Block] × 4, C =256
[Block] × 6, C =256
Stage 4
[Block] × 2, C =320
[Block] × 2, C =352
[Block] × 2, C =320
Table 1: Detailed architecture configurations of ACSAN variants for CIFAR-10 and CIFAR-100.
Stage
ACSAN_ImageNet_base
ACSAN_ImageNet_large
Stage 1
[Block] × 2, C =64
[Block] × 2, C =64
Stage 2
[Block] × 2, C =128
[Block] × 2, C =128
Stage 3
[Block] × 6, C =256
[Block] × 6, C =320
Stage 4
[Block] × 2, C =320
[Block] × 2, C =512
Table 2: Detailed architecture configurations of ACSAN variants for ImageNet database.
Model
Params (M)
FLOPs (M)
Top-1 Acc. (%)
ViT_small
8.04
541.31
90.61
ViT_base
9.82
661.34
90.50
ViT_large
10.71
721.36
90.63
ACSAN_small
8.03
53.84
93.26
ACSAN_base
9.75
58.87
93.52
ACSAN_large
11.06
66.68
93.38
Table 3: Comparison of ACSAN and ViT on CIFAR-10 dataset. All models are trained from scratch without pre-training.
Model
Params (M)
FLOPs (M)
Top-1 Acc. (%)
ViT_small
8.07
541.35
65.50
ViT_base
9.85
661.38
65.02
ViT_large
10.74
721.39
65.15
ACSAN_small
8.05
53.87
73.38
ACSAN_base
9.78
58.90
72.91
ACSAN_large
11.09
66.71
73.36
Table 4: Comparison of ACSAN and ViT on CIFAR-100 dataset. All models are trained from scratch without pre-training.
Model
Params (M)
FLOPs (G)
Top-1 Acc. (%)
ViT_ImageNet_base
12.24
14.05
81.1
ViT_ImageNet_large
21.69
22.40
81.9
Swin-T [ 13 ]
28.3
4.5
81.3
Swin-S [ 13 ]
49.6
8.7
83.0
ConvNext-T [ 14 ]
28.6
4.5
82.1
ConvNext-S [ 14 ]
50.0
8.7
83.1
Table 5: Comparison of ACSAN and baseline models on ImageNet dataset. All ViTs and ACSANs are trained from scratch.
Model
Params (M)
CIFAR-10 (%)
Channel Attn Only
9.78
93.28
Spatial Attn Only
9.78
93.29
ACSAN_base
9.78
93.52
Fully Convolution
9.58
89.47
Fully Depthwise Sep. Conv
9.52
89.14
DMFormer
9.85
88.70
Table 6: Ablation study results on CIFAR-10 database.