Enhancing Skin Cancer Diagnosis Using Swin Transformer with Hybrid Shifted Window-Based Multi-head Self-attention and SwiGLU-Based MLP
- PMID: 38839675
- PMCID: PMC11612041
- DOI: 10.1007/s10278-024-01140-8
Enhancing Skin Cancer Diagnosis Using Swin Transformer with Hybrid Shifted Window-Based Multi-head Self-attention and SwiGLU-Based MLP
Abstract
Skin cancer is one of the most frequently occurring cancers worldwide, and early detection is crucial for effective treatment. Dermatologists often face challenges such as heavy data demands, potential human errors, and strict time limits, which can negatively affect diagnostic outcomes. Deep learning-based diagnostic systems offer quick, accurate testing and enhanced research capabilities, providing significant support to dermatologists. In this study, we enhanced the Swin Transformer architecture by implementing the hybrid shifted window-based multi-head self-attention (HSW-MSA) in place of the conventional shifted window-based multi-head self-attention (SW-MSA). This adjustment enables the model to more efficiently process areas of skin cancer overlap, capture finer details, and manage long-range dependencies, while maintaining memory usage and computational efficiency during training. Additionally, the study replaces the standard multi-layer perceptron (MLP) in the Swin Transformer with a SwiGLU-based MLP, an upgraded version of the gated linear unit (GLU) module, to achieve higher accuracy, faster training speeds, and better parameter efficiency. The modified Swin model-base was evaluated using the publicly accessible ISIC 2019 skin dataset with eight classes and was compared against popular convolutional neural networks (CNNs) and cutting-edge vision transformer (ViT) models. In an exhaustive assessment on the unseen test dataset, the proposed Swin-Base model demonstrated exceptional performance, achieving an accuracy of 89.36%, a recall of 85.13%, a precision of 88.22%, and an F1-score of 86.65%, surpassing all previously reported research and deep learning models documented in the literature.
Keywords: Medical image analysis; Skin cancer detection; SwiGLU-based MLP; Swin Transformer; Vision transformer.
© 2024. The Author(s).
Conflict of interest statement
Declarations. Ethics Approval: No ethics approval was required for this work as it did not involve human subjects, animals, or sensitive data that would necessitate ethical review. Consent to Participate: No formal consent to participate was required for this work as it did not involve interactions with human subjects or the collection of sensitive personal information. Consent for Publication: This study did not use individual person’s data. Competing Interests: The authors declare no competing interests.
Figures







Similar articles
-
Enhanced Pneumonia Detection in Chest X-Rays Using Hybrid Convolutional and Vision Transformer Networks.Curr Med Imaging. 2025;21:e15734056326685. doi: 10.2174/0115734056326685250101113959. Curr Med Imaging. 2025. PMID: 39806960
-
SwinCross: Cross-modal Swin transformer for head-and-neck tumor segmentation in PET/CT images.Med Phys. 2024 Mar;51(3):2096-2107. doi: 10.1002/mp.16703. Epub 2023 Sep 30. Med Phys. 2024. PMID: 37776263 Free PMC article.
-
Swin-GA-RF: genetic algorithm-based Swin Transformer and random forest for enhancing cervical cancer classification.Front Oncol. 2024 Jul 19;14:1392301. doi: 10.3389/fonc.2024.1392301. eCollection 2024. Front Oncol. 2024. PMID: 39099689 Free PMC article.
-
HCformer: Hybrid CNN-Transformer for LDCT Image Denoising.J Digit Imaging. 2023 Oct;36(5):2290-2305. doi: 10.1007/s10278-023-00842-9. Epub 2023 Jun 29. J Digit Imaging. 2023. PMID: 37386333 Free PMC article. Review.
-
Efficient brain tumor segmentation using Swin transformer and enhanced local self-attention.Int J Comput Assist Radiol Surg. 2024 Feb;19(2):273-281. doi: 10.1007/s11548-023-03024-8. Epub 2023 Oct 5. Int J Comput Assist Radiol Surg. 2024. PMID: 37796413 Review.
Cited by
-
SkinEHDLF a hybrid deep learning approach for accurate skin cancer classification in complex systems.Sci Rep. 2025 Apr 28;15(1):14913. doi: 10.1038/s41598-025-98205-7. Sci Rep. 2025. PMID: 40295588 Free PMC article.
-
Addressing Challenges in Skin Cancer Diagnosis: A Convolutional Swin Transformer Approach.J Imaging Inform Med. 2025 Jun;38(3):1755-1775. doi: 10.1007/s10278-024-01290-9. Epub 2024 Oct 22. J Imaging Inform Med. 2025. PMID: 39436477 Free PMC article.
-
Application of improved Unet network in the recognition and segmentation of lung CT images in patients with pneumoconiosis.BMC Med Imaging. 2024 Aug 19;24(1):220. doi: 10.1186/s12880-024-01377-3. BMC Med Imaging. 2024. PMID: 39160488 Free PMC article.
-
An intelligent framework for skin cancer detection and classification using fusion of Squeeze-Excitation-DenseNet with Metaheuristic-driven ensemble deep learning models.Sci Rep. 2025 Mar 3;15(1):7425. doi: 10.1038/s41598-025-92293-1. Sci Rep. 2025. PMID: 40033075 Free PMC article.
-
Gray-Scale Extraction of Bone Features from Chest Radiographs Based on Deep Learning Technique for Personal Identification and Classification in Forensic Medicine.Diagnostics (Basel). 2024 Aug 15;14(16):1778. doi: 10.3390/diagnostics14161778. Diagnostics (Basel). 2024. PMID: 39202266 Free PMC article.
References
-
- S. Bibi, M.A. Khan, J.H. Shah, R. Damaševičius, A. Alasiry, M. Marzougui, M. Alhaisoni, A. Masood, MSRNet: Multiclass Skin Lesion Recognition Using Additional Residual Block Based Fine-Tuned Deep Models Information Fusion and Best Feature Selection, Diagnostics 2023, Vol. 13, Page 3063 13 (2023) 3063. 10.3390/DIAGNOSTICS13193063. - PMC - PubMed
-
- D. Gutman, N.C.F. Codella, E. Celebi, B. Helba, M. Marchetti, N. Mishra, A. Halpern, Skin Lesion Analysis toward Melanoma Detection: A Challenge at the International Symposium on Biomedical Imaging (ISBI) 2016, hosted by the International Skin Imaging Collaboration (ISIC), (2016). https://arxiv.org/abs/1605.01397v1 (accessed May 5, 2024).
-
- G. Akilandasowmya, G. Nirmaladevi, S.U. Suganthi, A. Aishwariya, Skin cancer diagnosis: Leveraging deep hidden features and ensemble classifiers for early detection and classification, Biomed Signal Process Control 88 (2024) 105306. https://doi.org/10.1016/J.BSPC.2023.105306.
-
- V. Dillshad, M.A. Khan, M. Nazir, O. Saidani, N. Alturki, S. Kadry, D2LFS2Net: Multi-class skin lesion diagnosis using deep learning and variance-controlled Marine Predator optimisation: An application for precision medicine, CAAI Trans Intell Technol (2023). https://doi.org/10.1049/CIT2.12267.
-
- Skin cancer statistics | World Cancer Research Fund International, (n.d.). https://www.wcrf.org/cancer-trends/skin-cancer-statistics/ (accessed July 31, 2023).
MeSH terms
Grants and funding
LinkOut - more resources
Full Text Sources
Medical