MultiAttenGastro: Multi-Dimensional Attention Augmentation for Gastrointestinal Endoscopy Classification
Organizations: Sardar Vallabhbhai National Institute of Technology, Surat, Gujarat, India · Swasthyam Gastro and Liver Hospital, Surat, Gujarat, India · Norwegian University of Science and Technology, Norway
Abstract
Automated gastrointestinal (GI) endoscopy classification requires models that generalize across diverse modalities and class distributions, often far from natural-image pretraining. We propose MultiAttenGastro, a plug-and-play attention framework with parallel 1-D channel, 2-D spatial, and 3-D contextual heads, and present the first systematic cross-dataset evaluation across eight CNN and transformer backbones on five public GI datasets (80 backbone--dataset runs). We find that attention effectiveness is not universal but tracks the representational gap between ImageNet features and the target distribution: MultiAttenGastro improves 6 of 8 backbones on Kvasir-Capsule (14-class WCE, large gap; best macro F1 98.33%), is uniformly negative on the small-gap Kvasir-v2 benchmark (0/8), and shows mixed outcomes on datasets with intermediate gap. Five-seed ablation on the strongest case (Kvasir-Capsule, ConvNeXt-Tiny) shows this improvement is directionally consistent, but not statistically decisive (paired : ; Wilcoxon: ), and that individual attention heads are not uniformly beneficial in isolation only their combination yields a positive mean effect. Centered Kernel Alignment (CKA) analysis links this pattern to representational redundancy: low inter-head CKA under large domain gaps coincides with the framework's only consistent gains, while high redundancy under small gaps coincides with its losses. We report these results, including the non-significant margins, as evidence for when and why multi-dimensional attention helps GI endoscopy classification, rather than as a claim that MultiAttenGastro is a strictly superior architectural choice.
Figures & tables
| Method | Backbone | Dataset | #Cls | Acc. | Macro F1 |
| Kvasir-v2 | |||||
| Al-Otaibi et al. [ 6 ] | EfficientNet-B1 | Kvasir-v2 | 8 | 98.94% | – |
| Attallah et al. [ 23 ] | CNN fusion ML | Kvasir-v2 | 8 | 97.8% | – |
| MultiAttenGastro | ResNet50 | Kvasir-v2 | 8 | 94.33% | 94.32% |
| HyperKvasir | |||||
| Li et al. [ 5 ] | 17-CNN ensemble | HyperKvasir | 10 | 95.30% | – |
| Dataset | Modality | Train | Val | Test | Imbalance | Gap | Wins | Losses |
| Kvasir-Capsule [ 3 ] | WCE | 9,299 | 1,641 | 2,354 | 3,434:1 | Large | 6/8 | 2/8 |
| SEE-AI 1 1 1 https://www.kaggle.com/datasets/capsuleyolo/kyucapsule | WCE | 12,943 | 2,769 | 2,769 | Moderate | Small | 4/8 | 4/8 |
| Kvasir-v2 [ 3 ] | Gastroscopy | 5,600 | 1,200 | 1,200 | Balanced | Small | 0/8 | 8/8 |
| HyperKvasir | Gastroscopy | 6,799 | 1,450 | 1,450 | Moderate | Small–Med | 3/8 | 5/8 |
| GastroVision | Gastroscopy | 7,785 | 1,662 | 1,662 | Moderate | Small–Med | 2/8 | 6/8 |
| Backbone | Params(Base) | Params( MAG) | F1 Base(%) | F1 MAG( %) |
| ResNet50 | 23.54M | 24.25M | 97.29 | 97.78 (+0.49) |
| DenseNet121 | 6.97M | 7.43M | 98.04 | 97.80 ( 0.24) |
| EfficientNet-B3 | 10.72M | 11.30M | 97.33 | 97.68 (+0.35) |
| Inception-v3 | 21.81M | 22.52M | 96.97 | 97.45 (+0.48) |
| MobileNet-v2 | 2.24M | 2.77M | 97.13 | 98.10 (+0.97) |
| MobileNet-v3-L | 2.99M | 3.43M | 97.79 | 97.49 ( 0.30) |
| Kvasir-v2 | HyperKvasir | GastroVision | SEE-AI | |||||
| Backbone | Base | MAG( ) | Base | MAG( ) | Base | MAG( ) | Base | MAG( ) |
| ResNet50 | 94.32 | 93.31( 1.01) | 83.89 | 84.63(+0.74) | 89.09 | 88.07( 1.02) | 69.61 | 69.81(+0.20) |
| DenseNet121 | 93.20 | 92.79( 0.41) | 83.75 | 83.48( 0.27) | 88.48 | 89.00(+0.52) | 75.04 | 66.33( 8.71) |
| EfficientNet-B3 | 93.74 | 91.87( 1.87) | 83.82 | 83.00( 0.82) | 88.71 | 87.82( 0.89) | 74.19 | 74.24(+0.05) |
| Inception-v3 | 91.98 | 89.19( 2.79) | 80.71 | 81.69(+0.98) | 87.19 | 85.75( 1.44) | 62.37 | 58.30( 4.07) |
| MobileNet-v2 | 93.08 | 92.48( 0.60) | 84.94 | 81.49( 3.45) | 90.45 | 86.63( 3.82) | 70.44 | 66.30( 4.14) |
| Configuration | F1 (%) | AUC(%) | F1 vs. base(%) | paired ( ) | Wilcoxon |
| No Attention | 98.096 0.341 | 99.973 | — | 0.793 (0.472) | 0.625 |
| 1D Channel | 97.694 0.598 | — | 0.402 | — | — |
| 2D Spatial | 97.894 0.323 | — | 0.202 | — | — |
| 3D Contextual | 98.132 0.127 | — | +0.036 | — | — |
| SE-Net [ 8 ] | 97.990 0.341 | — | 0.106 | 2.394 (0.075) | 0.125 |
| CBAM [ 9 ] | 98.098 0.351 | — | +0.002 | 0.919 (0.410) | 0.438 |
| Backbone | Baseline (min) | MAG (min) | Overhead (%) |
| ConvNeXt-Tiny | 22.22 | 23.18 | +4.3 |
| MobileNet-v2 | 12.54 | 13.14 | +4.8 |
| DenseNet121 | 24.42 | 26.66 | +9.2 |
| MobileNet-v3-Large | 12.88 | 14.26 | +10.7 |
| Dataset | Baseline F1 mean std (%) | Full MAG F1 mean std (%) | F1 (%) |
| Kvasir-v2 | 92.73 0.471 | 92.56 0.508 | 0.17 |
| HyperKvasir | 85.77 0.933 | 86.25 0.910 | +0.48 |
| SEE-AI | 77.39 2.622 | 76.62 1.685 | 0.77 |
| Dataset | Domain Gap | Mean inter-head CKA | Faithfulness gain |
| Kvasir-Capsule | Large | 0.577 | +0.021 |
| SEE-AI | Small | 0.749 | +0.008 |
| HyperKvasir | Small-Med | 0.858 | 0.080 |
| GastroVision | Small-Med | 0.858 | 0.052 |
| Kvasir-v2 | Small | 0.864 | 0.019 |
| Dataset | CKA(frozen, fine-tuned) | Test |
| SEE-AI | 0.122 | 2000 |
| Kvasir-Capsule | 0.225 | 2000 |
| HyperKvasir | 0.420 | 1450 |
| Kvasir-v2 | 0.459 | 1200 |
| GastroVision | 0.470 | 1662 |