A Vision Transformer with a Self-Attention Mechanism for High-Accuracy Blood Cell Classification
Received: 29 November 2025 | Revised: 28 December 2025 | Accepted: 4 January 2026 | Online: 9 February 2026
Corresponding author: Noor Ayesha
Abstract
Blood has several essential functions in the body, including immune defense against foreign elements and the transportation of oxygen, nutrients, and hormones. In this study, an IoT-based learning system was developed for classifying blood cell types, including basophils, erythroblasts, monocytes, myeloblasts, and segmented neutrophils. The study utilized a dataset of five blood cells, which was systematically split into three parts to ensure robust evaluations. A Convolutional Neural Network (CNN) model based on a Vision Transformer (ViT) combined with a Self-Attention Mechanism (SAM) was utilized to extract and learn discriminative features from cell images. To comprehensively evaluate and demonstrate execution, a suite of assessment metrics, classification reports, and Receiver Operating Characteristic (ROC) curves with the Area Under the Curve (AUC) was used in the training, validation, and testing phases. Overall, the proposed model achieved accuracies of 99%, 98%, and 98%, with balanced precision and recall, across the training, validation, and testing samples of five classes. Additionally, 5-fold cross-validation was conducted during the preparation and approval stages to improve generalizability and decrease overfitting. The model consistently demonstrated strong performance and maintained robust discriminative ability on the unseen test set. The proposed framework offers a promising solution to the limitations of conventional blood flow investigation by enabling digital, precise, and adaptable cell classification.
Keywords:
medical imaging, vision transformer, classification, cancer cells, health risksDownloads
References
N. Abbas et al., "Plasmodium Species Aware Based Quantification of Malaria Parasitemia in Light Microscopy Thin Blood Smear," Microscopy Research and Technique, vol. 82, no. 7, pp. 1198–1214, Jul. 2019. DOI: https://doi.org/10.1002/jemt.23269
A. Rehman, T. Mahmood, and T. Saba, "Robust Kidney Carcinoma Prognosis and Characterization Using Swin-ViT and DeepLabv3+ with Multi-model Transfer Learning," Applied Soft Computing, vol. 170, p. 112518, Feb. 2025. DOI: https://doi.org/10.1016/j.asoc.2024.112518
N. Abbas, Z. Mohamad, H. Abdullah, and A. Altameem, "Clustered Red Blood Cells Splitting via Boundary Analysis in Microscopic Thin Blood Smear Digital Images," International Journal of Technology, vol. 6, no. 3, p. 306, Jul. 2015. DOI: https://doi.org/10.14716/ijtech.v6i3.522
V. E. Espinoza and P. D. Emmady, Histology, Monocytes. Treasure Island, FL, USA: StatPearls Publishing, 2023.
A. Achir, I. Debbarh, N. Zoubir, I. Battas, H. Medromi, and F. Moutaouakkil, "Advances in Leukemia Detection and Classification: A Systematic Review of AI and Image Processing Techniques," F1000Research, vol. 13, p. 1536, Dec. 2024. DOI: https://doi.org/10.12688/f1000research.159318.1
M. Karimi et al., "Feature Selection Methods in Big Medical Databases: A Comprehensive Survey," International Journal of Theoretical & Applied Computational Intelligence, pp. 181–209, 2025. DOI: https://doi.org/10.65278/IJTACI.2025.21
A. Rehman, N. Abbas, T. Saba, Z. Mehmood, T. Mahmood, and K. T. Ahmed, "Microscopic Malaria Parasitemia Diagnosis and Grading on Benchmark Datasets," Microscopy Research and Technique, vol. 81, no. 9, pp. 1042–1058, Sept. 2018. DOI: https://doi.org/10.1002/jemt.23071
S. Nasir, M. Bilal, and H. Khalidi, "Detection and Classification of Skin Cancer by Using CNN-Enabled Cloud Storage Data Access Control Algorithm Based on Blockchain Technology," International Journal of Theoretical & Applied Computational Intelligence, pp. 146–159, 2025. DOI: https://doi.org/10.65278/IJTACI.2025.31
T. Saba, A. Sameh, F. Khan, S. A. Shad, and M. Sharif, "Lung Nodule Detection Based on Ensemble of Hand Crafted and Deep Features," Journal of Medical Systems, vol. 43, no. 12, p. 332, Dec. 2019. DOI: https://doi.org/10.1007/s10916-019-1455-6
B. Shehu Aliyu, J. Isuwa, A. Abdulrahim, M. Abdullahi, I. Hayatu Hassan, and T. Sikder Momi, "Enhanced Feature Selection for Imbalanced Microarray Cancer Gene Classification Using Chaotic Salp Swarm Algorithm," International Journal of Theoretical & Applied Computational Intelligence, pp. 259–283, 2025. DOI: https://doi.org/10.65278/IJTACI.2025.16
H. Ramoser, V. Laurain, H. Bischof, and R. Ecker, "Leukocyte Segmentation and Classification in Blood-Smear Images," in IEEE Engineering in Medicine and Biology 27th Annual Conference, Shanghai, China, 2005, pp. 3371–3374. DOI: https://doi.org/10.1109/IEMBS.2005.1617200
G. M. Devi and V. Neelambary, "Computer-Aided Diagnosis of White Blood Cell Leukemia Using VGG16 Convolution Neural Network," in 2022 4th International Conference on Inventive Research in Computing Applications, Coimbatore, India, Sept. 2022, pp. 1064–1068. DOI: https://doi.org/10.1109/ICIRCA54612.2022.9985611
M. Toğaçar, B. Ergen, and Z. Cömert, "Classification of White Blood Cells Using Deep Features Obtained from Convolutional Neural Network Models Based on the Combination of Feature Selection Methods," Applied Soft Computing, vol. 97, p. 106810, Dec. 2020. DOI: https://doi.org/10.1016/j.asoc.2020.106810
A. Bhattacherjee, V. Gupta, M. Kaur, S. Mehta, E. Jain, and P. Kaushik, "Blood Cell Cancer Classification Using ResNet50 and Transfer Learning: Enhancing Diagnostic Accuracy in Hematology," in 2024 International Conference on Decision Aid Sciences and Applications, Manama, Bahrain, Dec. 2024, pp. 1–6. DOI: https://doi.org/10.1109/DASA63652.2024.10836321
Md. I. H. Abir, S. D. Anik, and H. I. Peyal, "Explainable Multiclass Blood Cell Classification: Combining Custom CNNs with SHAP," in 2025 International Conference on Electrical, Computer and Communication Engineering, Chittagong, Bangladesh, Feb. 2025, pp. 1–4. DOI: https://doi.org/10.1109/ECCE64574.2025.11012986
T. Saba, S. T. F. Bokhari, M. Sharif, M. Yasmin, and M. Raza, "Fundus Image Classification Methods for the Detection of Glaucoma: A Review," Microscopy Research and Technique, vol. 81, no. 10, pp. 1105–1121, Oct. 2018. DOI: https://doi.org/10.1002/jemt.23094
R. Baluabid, H. Alnasri, R. Alowaybidi, R. Hafiz, A. Alsini, and M. Alharbi, "Detecting Acute Lymphocytic Leukemia in Individual Blood Cell Smear Images," Engineering, Technology & Applied Science Research, vol. 15, no. 1, pp. 19167–19173, Feb. 2025. DOI: https://doi.org/10.48084/etasr.9123
S. S. Kothwal, "Blood Cell Images for Cancer Detection." Kaggle, Jan. 2025, [Online]. Available: https://www.kaggle.com/datasets/sumithsingh/blood-cell-images-for-cancer-detection.
S. Iftikhar et al., "An Evolution Based Hybrid Approach for Heart Diseases Classification and Associated Risk Factors Identification," Biomedical Research, vol. 28, no. 8, pp. 3451–3455, 2017.
K. T. Navya, K. Prasad, and B. M. K. Singh, "Analysis of Red Blood Cells from Peripheral Blood Smear Images for Anemia Detection: A Methodological Review," Medical & Biological Engineering & Computing, vol. 60, no. 9, pp. 2445–2462, Sept. 2022. DOI: https://doi.org/10.1007/s11517-022-02614-z
R. Asghar, S. Kumar, and P. Hynds, "Automatic Classification of 10 Blood Cell Subtypes Using Transfer Learning via Pre-trained Convolutional Neural Networks," Informatics in Medicine Unlocked, vol. 49, p. 101542, 2024. DOI: https://doi.org/10.1016/j.imu.2024.101542
O. Saidani et al., "White Blood Cells Classification Using Multi-Fold Pre-processing and Optimized CNN Model," Scientific Reports, vol. 14, no. 1, p. 3570, Feb. 2024. DOI: https://doi.org/10.1038/s41598-024-52880-0
X. Wang, G. Pan, Z. Hu, and A. Ge, "A Two Stage Blood Cell Detection and Classification Algorithm Based on Improved YOLOv7 and EfficientNetv2," Scientific Reports, vol. 15, no. 1, p. 8427, Mar. 2025. DOI: https://doi.org/10.1038/s41598-025-91720-7
S. Kasim et al., "Multiclass Leukemia Cell Classification Using Hybrid Deep Learning and Machine Learning with CNN-Based Feature Extraction," Scientific Reports, vol. 15, no. 1, p. 23782, Jul. 2025. DOI: https://doi.org/10.1038/s41598-025-05585-x
Downloads
How to Cite
License
Copyright (c) 2026 Noor Ayesha, Humaira Khalidi

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain the copyright and grant the journal the right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) after its publication in ETASR with an acknowledgement of its initial publication in this journal.
