Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2025 Jul 1;15(1):21343.
doi: 10.1038/s41598-025-09311-5.

Hybrid transfer learning and self-attention framework for robust MRI-based brain tumor classification

Affiliations

Hybrid transfer learning and self-attention framework for robust MRI-based brain tumor classification

Soumyarashmi Panigrahi et al. Sci Rep. .

Abstract

Brain tumors are a significant contributor to cancer-related deaths worldwide. Accurate and prompt detection is crucial to reduce mortality rates and improve patient survival prospects. Magnetic Resonance Imaging (MRI) is crucial for diagnosis, but manual analysis is resource-intensive and error-prone, highlighting the need for robust Computer-Aided Diagnosis (CAD) systems. This paper proposes a novel hybrid model combining Transfer Learning (TL) and attention mechanisms to enhance brain tumor classification accuracy. Leveraging features from the pre-trained DenseNet201 Convolutional Neural Networks (CNN) model and integrating a Transformer-based architecture, our approach overcomes challenges like computational intensity, detail detection, and noise sensitivity. We also evaluated five additional pre-trained models-VGG19, InceptionV3, Xception, MobileNetV2, and ResNet50V2 and incorporated Multi-Head Self-Attention (MHSA) and Squeeze-and-Excitation Attention (SEA) blocks individually to improve feature representation. Using the Br35H dataset of 3,000 MRI images, our proposed DenseTransformer model achieved a consistent accuracy of 99.41%, demonstrating its reliability as a diagnostic tool. Statistical analysis using Z-test based on Cohen's Kappa Score, DeLong's test based on AUC Score and McNemar's test based on F1-score confirms the model's reliability. Additionally, Explainable AI (XAI) techniques like Gradient-weighted Class Activation Mapping (Grad-CAM) and Local Interpretable Model-agnostic Explanations (LIME) enhanced model transparency and interpretability. This study underscores the potential of hybrid Deep Learning (DL) models in advancing brain tumor diagnosis and improving patient outcomes.

Keywords: Brain Tumor Classification; Deep Learning; DenseNet201 Pre-trained Model; Self Attention; Squeeze-and-Excitation; Transfer Learning; Transformer.

PubMed Disclaimer

Conflict of interest statement

Declarations. Competing interests: The authors declare no competing interests.

Figures

Fig. 1
Fig. 1
Transfer learning process.
Fig. 2
Fig. 2
Normal and tumor brain MRI images.
Fig. 3
Fig. 3
Cropped Normal brain MRI image.
Fig. 4
Fig. 4
Structural Layout of our proposed model.
Fig. 5
Fig. 5
Modified DenseNet201 architecture details.
Fig. 6
Fig. 6
(a) SEA block in details and (b) MHSA block in Transformer in details.
Fig. 7
Fig. 7
Architecture of our proposed hybrid DenseTransformer.
Fig. 8
Fig. 8
Confusion Matrices of Proposed DenseTransformer model with different sets of brain tumor images (a) MHSA (BT-800), (b) MHSA (BT-1200) (c) SEA (BT-800), and (d) SEA (BT-1200).
Fig. 9
Fig. 9
Training and validation accuracy/loss curve of the Proposed DenseTransformer model with (a) MHSA (BT-800) (b) MHSA (BT-800) (c) MHSA (BT-1200) (d) MHSA (BT-1200) (e) SEA (BT-800) (f) SEA (BT-800) (g) SEA (BT-1200) (h) SEA (BT-1200) different sets of brain tumor images.
Fig. 10
Fig. 10
Comparative analysis of Brier Score of various models with Proposed DenseTransformer.
Fig. 11
Fig. 11
Comparison of Cohen’s Kappa Score and MCC Score.
Fig. 12
Fig. 12
Comparison of Sensitivity and Specificity.
Fig. 13
Fig. 13
Comparison of PPV and NPV.
Fig. 14
Fig. 14
Jaccard Index Comparison of proposed DesneTransformer.
Fig. 15
Fig. 15
FPR Vs FNR Comparison of proposed DesneTransformer.
Fig. 16
Fig. 16
Comparison of ROC curves of proposed DesneTransformer.
Fig. 17
Fig. 17
PR Curve of the proposed DenseTransformer (MHSA, BT-800).
Fig. 18
Fig. 18
Test loss Comparison graph of our Proposed DenseTransformer.
Fig. 19
Fig. 19
Hamming loss Comparison graph of our Proposed DenseTransformer.
Fig. 20
Fig. 20
Calibration curve of proposed DenseTransformer (MHSA, (BT-800)).
Fig. 21
Fig. 21
Confusion matrices of various models using the Brain MRI dataset (ad) : (a) DenseTransformer with MHSA, (b) DenseTransformer with MHSA(Partial Fine Tuning), (c) DenseTransformer with SEA, (d) DenseNet201, (e) DenseTransformer with MHSA(Partial Fine Tuning) for Br35H dataset.
Fig. 22
Fig. 22
(a) Training and validation accuracy curve (b) Training and validation loss curve of the proposed DenseTransformer with Brain MRI dataset.
Fig. 23
Fig. 23
Grad-CAM and LIME interpretation of Normal MRI images of Br35H dataset.
Fig. 24
Fig. 24
Grad-CAM and LIME interpretation of Tumor MRI images of Br35H dataset.

References

    1. Brain Tumor Organization. Brain tumor facts. Retrieved from https://braintumor.org/brain-tumors/about-brain-tumors/brain-tumor-facts/.
    1. Van de Voorde, P., Monsieurs, K. G., Mols, P., Cheskes, S., Baldi, E., Burkart, R. et al. The impact of bystander automated external defibrillator use on survival: a systematic review and meta-analysis. Arch. Public Health. 80, 65. Available at: https://archpublichealth.biomedcentral.com/articles/10.1186/s13690-022-0... (2022). - DOI
    1. Paul, M., Goswami, S. & Bora, G. Clinico-epidemiological profile of primary brain tumours in North-Eastern region of India: a retrospective single institution study. Asian Pac. J. Cancer Care8, 333–336 (2023).
    1. Cohen-Gadol, A. Brain tumor statistics. Retrieved from https://www.aaroncohen-gadol.com/en/patients/brain-tumor/types/statistics (2024).
    1. World Health Organization. Global cancer burden growing amidst mounting need for services. Retrieved from https://www.who.int/news/item/01-02-2024-global-cancer-burden-growing--a... (2024). - PMC - PubMed

MeSH terms