###### Abstract  
Brain tumors can be serious; consequently, rapid and accurate detection is crucial. Nevertheless, a variety of obstacles, such as poor imaging resolution, doubts over the accuracy of data, a lack of diverse tumor classes and stages, and the possibility of misunderstanding, present challenges to achieve an accurate and final diagnosis. Effective brain cancer detection is crucial for patients' safety and health. Deep learning systems provide the capability to assist radiologists in quickly and accurately detecting diagnoses. This study presents an innovative deep learning approach that utilizes the Swin Transformer. The suggested method entails integrating the Swin Transformer with the pretrained deep learning model Resnet50V2, called (SwT+Resnet50V2). The objective of this modification is to decrease memory utilization, enhance classification accuracy, and reduce training complexity. The self-attention mechanism of the Swin Transformer identifies distant relationships and captures the overall context. Resnet 50V2 improves both accuracy and training speed by extracting adaptive features from the Swin Transformer's dependencies. We evaluate the proposed framework using two publicly accessible brain magnetic resonance imaging (MRI) datasets, each including two and four distinct classes, respectively. Employing data augmentation and transfer learning techniques enhances model performance, leading to more dependable and cost-effective training. The suggested model achieves an impressive accuracy of 99.9% on the binary-labeled dataset and 96.8% on the four-labeled dataset, outperforming the VGG16, MobileNetV2, Resnet50V2, EfficientNetV2B3, ConvNeXtTiny, and convolutional neural network (CNN) algorithms used for comparison. This demonstrates that the Swin transducer, when combined with Resnet50V2, is capable of accurately diagnosing brain tumors. This method leverages the combination of SwT+Resnet50V2 to create an innovative diagnostic tool. Radiologists have the potential to accelerate and improve the detection of brain tumors, leading to improved patient outcomes and reduced risks. Swin Transformer; brain tumor classification; deep learning; vision transformer; MRI image 4.0/. +
Footnote †: journal: Medicalglobally, posing a significant health risk. Glioma, a prevalent primary tumor of the brain, occurs when glial cells in the brain and spinal cord undergo malignant transformation. Tumor growth, whether benign or malignant, results in elevated intracranial pressure. The presence of the tumor causes brain impairment, which may ultimately end in mortality. A total of 86,000 newly diagnosed cases of brain tumors were reported in 2019. Around 17,000 individuals have passed away from this disease since 2019 [2]. Brain tumors have been investigated by scientists and researchers, who have created innovative diagnostic techniques and treatments. Computed tomography (CT) and magnetic resonance imaging (MRI) are two commonly employed methods for identifying abnormalities in the position, dimensions, or configuration of brain tissue. Medical professionals prefer MRI over other diagnostic procedures, and there is an increasing emphasis on research in this area. Three different forms of cancer are visible in the MRI scan in Section 4. Brain tumors are a serious health concern, posing significant risks to human life. They can lead to various neurological impairments, and if left untreated, they can be fatal. The early detection and accurate classification of brain tumors are crucial for effective treatment and improved patient outcomes. Researchers have used traditional machine learning techniques to analyze medical images, including brain MRI scans, for tumor detection. However, these methods often struggle to capture the complex patterns and features present in medical images. Deep learning, a subset of machine learning, has emerged as a powerful tool for analyzing complex data and has shown promising results in various medical imaging applications.