arXiv:2610.33965cs.CVOct 2026

Manuscript Offprint

arXiv:2610.33965

Accuracy Is Not Enough: An Efficiency- and Statistics-Aware Benchmark of ResNet50 and Vision Transformer for Explainable Multi-Class Gastrointestinal Diseases Classification

Akwasi Asare

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

Abstract

Automated classification of gastrointestinal (GI) findings in endoscopic images could support early diagnosis, but architectures are often chosen on accuracy alone. We present a controlled, reproducible benchmark of ResNet50 and ViT-B/16 for eight-class GI classification on the public Kvasir dataset (4,000 images), using a stratified split (400 test images) and stratified group 5-fold cross-validation over all images. In cross-validation, ResNet50 and ViT-B/16 reached 92.12% and 91.70% accuracy, and a two one-sided tests (TOST) procedure showed equivalence within a ±3 percentage-point margin (difference +0.43 points, 90% CI -0.33 to +1.18; p < 0.001). The architectures differed mainly in cost: ResNet50 had 3.6 times fewer parameters and 4.3 times fewer operations, 2.5-fold lower single-image CPU latency (69 vs. 177 ms) and 3.8-fold higher GPU throughput. Cross-validated calibration was similar (expected calibration error 0.021 vs. 0.023). An edge-oriented transformer, MobileViT-S, was most accurate on the test split (95.5%) but lost 9.4 points when an acquisition artefact present in some classes (the ScopeGuide inset) was occluded, whereas ResNet50 was not significantly affected. On 500 unseen polyp images with expert masks, both models' Grad-CAM maps focused on the lesion (3.6 times chance). On a de-duplicated external subset of GastroVision (1,998 images), accuracy fell to 78–80% for all three models and differences between them remained small. Accuracy differences between architectures were thus small relative to the effects of shortcut learning and domain shift, whereas efficiency differences were large. An efficient CNN is a defensible default for resource-constrained screening, but no model is deployment-ready without local validation.

Keywords: Gastrointestinal disease classification; endoscopic imaging; ResNet50; Vision Transformer; equivalence testing; shortcut learning; resource-constrained deployment.

1 Introduction

Gastrointestinal (GI) diseases including inflammatory disorders, ulcers, polyps, and cancers remain among the most prevalent causes of morbidity and mortality worldwide, cause a significant strain on healthcare resources [1−3][1-3]. The International Agency for Research on Cancer (IARC), the World Health Organization's (WHO) specialized cancer agency, reports that gastrointestinal (GI) cancers are responsible for approximately 3.5 million new cases globally each year. These types of cancers collectively account for an estimated 2.2 million deaths annually, a mortality-to-incidence ratio of about 63% [4]. Early and accurate detection of GI abnormalities can dramatically improve treatment outcomes, yet timely diagnosis remains a challenge in many clinical settings due to increasing patient loads, a shortage of trained endoscopists, and the subjective nature of visual interpretation [5]. Conventional endoscopy, while highly effective for visualizing the internal structure of the gastrointestinal tract, relies heavily on the expertise of clinicians to detect and classify pathological features and it can lead to potential errors in disease classification [6]. Although endoscopy stands as the undisputed gold standard for inspecting the gastrointestinal (GI) tract [4], its true potential is significantly curtailed by a critical variable: operator performance. The efficacy of this vital procedure, therefore, hinges directly on the skill and consistency of the individual wielding the endoscope. Inter-observer variability and operator fatigue can lead to missed or delayed diagnoses, especially in subtle or early-stage cases. To address these challenges, researchers and clinicians have increasingly turned to artificial intelligence (AI) and deep learning systems to augment diagnostic workflows and reduce human error.

Recent advances in computer vision, particularly convolutional neural networks (CNNs), have demonstrated significant success in medical image classification, segmentation, and anomaly detection tasks [7–9]. Architectures such as ResNet, DenseNet, and Inception have been widely adopted in gastrointestinal imaging, showing high performance in tasks like polyp detection[10], ulcer identification, and disease staging [11]. These models excel in learning hierarchical spatial features through convolutional filters, making them well-suited to identifying texture and shape abnormalities in medical images [5, 11].

However, despite the success of CNNs, they suffer from certain limitations. CNNs are inherently biased toward local patterns due to their receptive field constraints and inductive biases. This makes them less effective in modeling long-range dependencies or capturing global context an important consideration in medical imaging where subtle variations in texture and anatomical structures may span large regions of the image [12]. Vision Transformers (ViTs), a recent innovation in the computer vision community, offer a promising alternative. Inspired by transformer models in natural language processing, ViTs utilize self-attention mechanisms to model relationships between all parts of an image simultaneously [13, 14]. This global reasoning capability enables ViTs to potentially outperform CNNs in tasks requiring holistic interpretation [12, 15]. However, ViTs generally require larger datasets and are computationally more intensive, raising questions about their practical utility in medical imaging, where labeled data is limited, and real-time processing is often critical [16].

To explore these trade-offs, we conduct a systematic comparison between ResNet50, a widely used, lightweight CNN, and ViT-B/16, a transformer-based architecture, complemented by an edge-oriented hybrid transformer (MobileViT-S), for multi-class gastrointestinal disease classification using the Kvasir dataset. The Kvasir dataset contains 4,000 annotated endoscopic images representing eight clinically relevant classes: dyed-lifted-polyps (post-treatment assessment), dyed-resection-margins (surgical boundary evaluation), esophagitis (inflammation), normal-cecum (healthy colon start), normal-pylorus (stomach exit), normal-z-line (esophagus-stomach junction), polyps (pre-cancerous growths), and ulcerative-colitis (chronic inflammation). Unlike prior works that focus on binary classification or polyp segmentation, we evaluate these models on a more challenging 8-class classification task that better reflects real-world clinical complexity. In addition to classification accuracy, we assess the models across several critical dimensions: computational efficiency (in terms of MACs and parameter count), generalization (held-out test accuracy, cross-validation and an external dataset), calibration, explainability (Grad-CAM, LIME, SHAP and attention rollout), and robustness to an acquisition artefact. By analyzing both overall metrics and class-specific performance, we aim to uncover the strengths and limitations of each architecture and provide practical guidelines for model deployment in clinical settings.

This paper makes the following key contributions:

  1. We provide a controlled, fully reproducible benchmark of a standard CNN (ResNet50) and a standard Vision Transformer (ViT-B/16) for 8-class gastrointestinal disease classification, evaluated on a fixed stratified split and with stratified group 5-fold cross-validation in which near-duplicate images are never split across folds. Rather than inferring equivalence from a non-significant test, we combine McNemar's paired test with a two one-sided tests (TOST) equivalence procedure and a ±3 percentage-point margin, and show that the two architectures are equivalent in cross-validated accuracy (92.12% vs. 91.70%; 90% CI for the difference −0.33 to +1.18 points).

  2. We characterize computational cost with a standardized protocol (parameters, multiply-accumulate operations, GPU and CPU latency and throughput, peak memory, and training time). ResNet50 needs 3.6×3.6\times fewer parameters and 4.3×4.3\times fewer operations, runs 2.5×2.5\times faster on a CPU, has 3.8×3.8\times higher GPU throughput and reaches its best checkpoint about four times sooner. We complement this with calibration analysis (three ECE binning schemes, class-wise ECE, Brier score and negative log-likelihood, with and without label smoothing), positive predictive values at realistic prevalence, and a multi-method interpretability assessment (Grad-CAM, LIME, SHAP and attention rollout) that includes lesion-level localization against expert polyp masks.

  3. We test robustness beyond the curated benchmark. An occlusion experiment shows that an edge-oriented transformer (MobileViT-S), the most accurate model on the test split, depends on an acquisition artefact (the ScopeGuide inset) far more than ResNet50, and an evaluation on a de-duplicated external subset of GastroVision shows a 13–17 point accuracy drop for all models. We translate these findings into deployment-oriented guidance and delineate the limitations that bound them.

The remainder of this paper is organized as follows: Section 2 reviews the related literature; Section 3 details the dataset, model architectures, and training and evaluation methodology; Section 4 presents and discusses the experimental results including classification performance, statistical significance testing, computational efficiency, calibration, interpretability, robustness to an acquisition artefact and external evaluation, together with the limitations of the study; and Section 5 concludes with directions for future research.

References (51)