Classification of Endoscopy and Video Capsule Images Using CNN-Transformer Model

Aliza Subedi, Smriti Regmi, Nisha Regmi, Bhumi Bhusal, Ulas Bagci, Debesh Jha

Abstract

Early detection of gastrointestinal (GI) anomalies through endoscopy is critical for improving patient survival rates. However, manual identification of lesions is subjective and error-prone. This paper presents a hybrid deep learning architecture that integrates the local feature extraction of Convolutional Neural Networks (CNNs) with the global context awareness of Transformers. By fusing DenseNet201 and Swin Transformer branches, the proposed model achieves state-of-the-art performance on complex, imbalanced endoscopic and video capsule datasets, offering a robust and interpretable tool for clinical decision support.

Introduction

Gastrointestinal cancer is a leading cause of global mortality. While endoscopic procedures are the gold standard for diagnosis, the identification of polyps, lesions, and anatomical landmarks relies heavily on the expertise of gastroenterologists. This process is susceptible to inter-observer variability and human fatigue. Automated systems using deep learning have shown promise, but standard CNNs often fail to capture long-range spatial dependencies, while pure Transformers require extensive data to learn local textures. This study addresses these limitations by proposing a dual-branch hybrid model designed for the high visual complexity and class imbalance of medical GI imaging.

Methodology

The proposed architecture employs a parallel dual-branch strategy to process input images:

  1. CNN Branch (DenseNet201): Leverages dense connectivity and feature reuse to extract fine-grained local textures and edges, which are essential for identifying the surface characteristics of lesions.
  2. Transformer Branch (Swin-T): Utilizes a hierarchical Shifted Window (Swin) Transformer to capture global spatial relationships, providing context for how different anatomical regions relate to one another.
Hybrid CNN-Transformer architecture combining DenseNet201 and Swin Transformer branches.

Features from both branches are concatenated and processed through a Classifier Block consisting of a dense layer (256 units), LeakyReLU activation, batch normalization, and dropout to mitigate overfitting.

Experimental Setup and Datasets

The model was validated on two publicly available datasets:

  • GastroVision: Comprising 7,930 images across 22 classes, including anatomical landmarks and pathological findings.
  • Kvasir-Capsule: A large-scale video capsule endoscopy (VCE) dataset. Eleven classes were selected to evaluate the model's performance on lower-resolution, highly imbalanced imagery.

Results

The hybrid model consistently outperformed standalone architectures across all primary metrics:

  • GastroVision: The model achieved an accuracy of 0.8386 and a Matthews Correlation Coefficient (MCC) of 0.8191, surpassing standalone DenseNet201 and Swin-T by significant margins.
  • Kvasir-Capsule: Despite the inherent difficulty of VCE imagery, the model reached an MCC of 0.3871, outperforming baseline models like ResNet50 and Xception.
  • Reliability: 5-fold cross-validation demonstrated low standard deviation, indicating the model's robustness across different data partitions.

Interpretability and Clinical Insights

A key contribution of this work is the focus on model interpretability. Using saliency maps, the researchers visualized the pixels most influential to the classification decision.

Saliency maps demonstrating the model's focus on medically relevant features such as polyps and tools.

These visualizations confirm that the model focuses on clinically relevant features—such as the specific morphology of a polyp or the presence of surgical tools—rather than background artifacts. This transparency is vital for establishing clinical trust and ensuring the model's utility in a real-world medical environment.

Conclusion and Future Work

The fusion of local and global feature extraction provides a powerful framework for GI image classification. While the hybrid model shows superior performance and interpretability, challenges remain regarding the extreme class imbalance in VCE data and the increased computational cost of dual-branch architectures. Future research will focus on optimizing model efficiency and collaborating with clinical professionals to integrate this system into hospital workflows.

Summary updated

BibTeX
@inproceedings{subedi2024classification,
  author = {Aliza Subedi and Smriti Regmi and Nisha Regmi and Bhumi Bhusal and Ulas Bagci and Debesh Jha},
  title = {{Classification of Endoscopy and Video Capsule Images Using CNN-Transformer Model}},
  booktitle = {CaPTion @ MICCAI},
  year = {2024},
  doi = {10.1007/978-3-031-73376-5\_3},
}
Figure