Abstract
In diagnostics, accurate and timely identification of brain tumors can influence the outcome of the patient's treatment plan and prognosis. This research proposes RanMer-Former, a novel model combining Vision Transformers (ViTs), Explainable AI (XAI) with Grad-CAM, and token merging methods for effective MRI-based brain tumor detection. The dataset comprises 7,023 MRI scans across four categories: Thus, it has been classified as either having Glioma, Meningioma, Pituitary tumors or No Tumor. RanMerFormer outperformed a baseline CNN model, achieving an accuracy of 89.7%, precision of 90.1%, recall of 89.5%, and an F1 score of 89.8%. The Grad-CAM visualizations provided confirmation to the rationale made by the model to focus on certain regions of the tumor. This research demonstrates the application of RanMerFormer in clinical practice and suggests an effective approach to diagnose brain tumors.