Manuscript Offprint

arXiv:2609.05070

MultiAttenGastro: Multi-Dimensional Attention Augmentation for Gastrointestinal Endoscopy Classification

Sadhana Devarajan, Praveen Kumar Chandaliya, Dhruvin Jashvant Kumar Shah, Kishor Upla, Kiran Raja

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Sadhana Devarajan¹, Praveen Kumar Chandaliya¹, Dhruvin Jashvant Kumar Shah², Kishor Upla¹, and Kiran Raja³

¹ Sardar Vallabhbhai National Institute of Technology, Surat, Gujarat, India u23ai003@svnit.ac.in, pkc@aid.svnit.ac.in, kpu@eced.svnit.ac.in

² Swasthyam Gastro and Liver Hospital, Surat, Gujarat, India dhruvin.mge@gmail.com

³ Norwegian University of Science and Technology, Norway kiran.raja@ntnu.no

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 tt: p=0.47p = 0.47; Wilcoxon: p=0.63p = 0.63), 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.

Keywords: Wireless Capsule Endoscopy · Gastrointestinal Classification · Attention Mechanism · Explainable AI

1 Introduction

Wireless capsule endoscopy (WCE) produces up to 50,000 frames over 8–10 hours as a pill-sized camera traverses the GI tract [1,2]. Pathologies such as bleeding,

Devarajan et. al.

polyps, or erosions may appear in fewer than 0.1% of frames, making automated classification a clinical necessity. The Kvasir-Capsule benchmark [3] exemplifies this challenge with 47,238 labelled WCE images across 14 categories and an extreme 3,434:1 imbalance between normal and rare pathology. Gastroscopy datasets such as Kvasir-v2, HyperKvasir, and GastroVision extend the task to 8–27 classes in a modality visually closer to natural images.

We propose MultiAttenGastro, a plug-and-play framework that applies parallel 1D + 2D + 3D attention mechanisms to GI endoscopy classification, capturing channel, spatial, and contextual dependencies for fine-grained lesion discrimination. Unlike prior single-dataset studies, we conduct the first systematic cross-dataset evaluation of multi-dimensional attention across diverse GI imaging conditions. Our findings show that attention effectiveness is not universal but correlates with a measurable factor: initial results suggested a modality-dependent effect (helping WCE, hurting gastroscopy), but adding SEE-AI revealed mixed outcomes that modality alone could not explain. The strongest associated factor is the representation gap between ImageNet-pretrained features and the target dataset — large for Kvasir-Capsule's rare pathologies, small for gastroscopy's natural-image-like appearance, and small for SEE-AI's simpler four-class taxonomy despite its WCE modality. We treat this as an empirical association supported by five-seed ablation, CKA analysis, and Grad-CAM (Sects. 5.3–7), not as a proven causal mechanism; Sect. 7.2 shows the association is not perfect even within our own data.

This paper makes the following contributions:

(i) We propose MultiAttenGastro and evaluate it across eight CNN and transformer backbones and five datasets (80 runs), constituting the first cross-dataset study of multi-dimensional attention in GI imaging.

(ii) We show that MultiAttenGastro's effectiveness correlates with the representational domain gap between ImageNet pretraining and the target dataset, rather than imaging modality: it helps under large gap (Kvasir-Capsule), hurts uniformly under small gap (Kvasir-v2), and is mixed at intermediate gap, with SEE-AI (WCE, small gap) confirming that modality alone does not determine outcome.

(iii) Through five-seed ablation, paired significance testing, and CKA analysis, we show that (a) the module's benefit on its strongest case is directionally consistent but not statistically significant at n=5n = 5 seeds, (b) individual attention heads are not independently beneficial — only their combination is — and (c) this pattern correlates with inter-head representational redundancy, which is itself gap-dependent.

(iv) We qualitatively corroborate this framework with Grad-CAM, showing lesion-focused activation gains on the high-gap dataset and dispersed, non-diagnostic activation shifts on the low-gap dataset.

References (29)

  • Vision-based personalized wireless capsule endoscopy for smart healthcare
  • Wireless capsule endoscopy
  • Kvasir-Capsule, a video capsule endoscopy dataset
  • Abnormality classification in small datasets of capsule endoscopy images
  • Enhanced accuracy for classification of video capsule endoscopy images using multiple deep learning convolutional neural networks
  • Efficient-gastro: optimized EfficientNet for gastrointestinal disorders via transfer learning
  • Precision enhancement in wireless capsule endoscopy: a novel transformer-based approach for real-time video object detection
  • Squeeze-and-excitation networks
  • CBAM: Convolutional block attention module
  • Multidimensional weighted attention-guided network for diabetic retinopathy grading
  • Systematic integration of attention modules into CNNs for medical image classification
  • Attention U-Net: Learning Where to Look for the Pancreas
  • Attention gated networks: Learning to leverage salient regions in medical images
  • AW-Net: A novel fully connected attention-based medical image segmentation model
  • PanNet: A feature-based attention aggregation model for segmenting pancreatic ductal adenocarcinoma on contrast-enhanced CT images of the abdomen
  • Coordinate attention for efficient mobile network design
  • Rotate to attend: Convolutional triplet attention module
  • ECA-Net: Efficient channel attention for deep convolutional neural networks
  • Score-CAM: Score-weighted visual explanations for convolutional neural networks
  • Why should I trust you?
  • A unified approach to interpreting model predictions
  • Grad-CAM: Visual explanations from deep networks via gradient-based localization
  • EndoNet: A multiscale deep learning framework for multiple gastrointestinal disease classification via endoscopic images
  • Explainable AI in digestive healthcare and gastrointestinal endoscopy
  • Towards full integration of explainable AI in colon capsule endoscopy
  • EfficientNet: Rethinking model scaling for convolutional neural networks
  • Densely connected convolutional networks
  • Similarity of neural network representations revisited
  • Capsule Endoscopy Multi-classification via Gated Attention and Wavelet Transformations (opens arXiv in a new tab)