An Explainable Vision Transformer Model Based White Blood Cells Classification and Localization
Abstract
:1. Introduction
- Using Raabin-WBC, a dataset that contains five different types of WBCs and is more comprehensive than previous datasets, classification is performed with the ViT deep learning model.
- A method is proposed to visualize the areas that the ViT model focuses on in its predictions with the Score-CAM algorithm.
- In the predictions made on the input images, which are divided into 16 × 16 pixel patches and then vectorized, the class probabilities are calculated with the softmax.
- The proposed method shows high accuracy and precise localization. The model also achieves high softmax values in successful predictions, outperforming CNN models in similar studies.
2. Materials and Methods
2.1. WBCs Dataset
2.2. Transformer-Based Image Classification Method
3. Experiments
3.1. Experimental Setup
3.2. Performance Evaluation Metrics
3.3. Results
4. Discussion
- The proposed model is based on vision transformers that has become popular research field. Therefore, this study is an example to examine vision transformers performance in biomedical image classification.
- Since the ViT model used in the study was trained on large datasets, it performed well on the WBC classification problem with a low training cost.
- This model can classify WBCs images with end-to-end transformer structure. There is no need to use any feature engineering.
- Due to the explainable structure, the proposed model presents focused regions during the classification process. According to these results, experts can validate model performance.
- Due to its high level of classification accuracy, it has the potential to be utilized in clinical applications.
- Trained with the Rabbin-WBC dataset, the model can be fine-tuned to classify different cell types and can be easily implemented.
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Al-Dulaimi, K.A.K.; Banks, J.; Chandran, V.; Tomeo-Reyes, I.; Nguyen Thanh, K. Classification of White Blood Cell Types from Microscope Images: Techniques and Challenges. In Microscopy Science: Last Approaches on Educational Programs and Applied Research (Microscopy Book Series, 8); Formatex Research Center: Badajoz, Spain, 2018; pp. 17–25. [Google Scholar]
- Ahmad, Z.; Shah, T.A.; Reddy, K.P.; Ghosh, S.; Panpatil, V.; Kottoru, S.K.; Rayees, S.; Rao, D.R. Immunology in Medical Biotechnology. In Fundamentals and Advances in Medical Biotechnology; Springer: Berlin/Heidelberg, Germany, 2022; pp. 179–207. [Google Scholar]
- Kiboneka, A.N. Basic Concepts in Clinical Immunology: A Review. World J. Adv. Res. Rev. 2021, 12, 490–496. [Google Scholar] [CrossRef]
- Tripathi, C. Tolerance and Autoimmunity. In An Interplay of Cellular and Molecular Components of Immunology; CRC Press: Boca Raton, FL, USA, 2022; pp. 207–216. ISBN 1003286429. [Google Scholar]
- Otieno, F.; Kyalo, C. Perspective Chapter: Macrophages Plasticity and Immune Metabolism. In Basic and Clinical Aspects of Interferon Gamma; IntechOpen: London, UK, 2022; ISBN 1803558865. [Google Scholar]
- Wechsler, M.E.; Munitz, A.; Ackerman, S.J.; Drake, M.G.; Jackson, D.J.; Wardlaw, A.J.; Dougan, S.K.; Berdnikovs, S.; Schleich, F.; Matucci, A. Eosinophils in Health and Disease: A State-of-the-Art Review. In Proceedings of the Mayo Clinic Proceedings; Elsevier: Amsterdam, The Netherlands, 2021; Volume 96, pp. 2694–2707. [Google Scholar]
- Santos, A.F.; Alpan, O.; Hoffmann, H. Basophil Activation Test: Mechanisms and Considerations for Use in Clinical Trials and Clinical Practice. Allergy 2021, 76, 2420–2432. [Google Scholar] [CrossRef] [PubMed]
- Parente, J. Diagnostics for White Blood Cell Abnormalities: Leukocytosis and Leukopenia. Physician Assist. Clin. 2019, 4, 625–635. [Google Scholar] [CrossRef]
- Agnello, L.; Giglio, R.V.; Bivona, G.; Scazzone, C.; Gambino, C.M.; Iacona, A.; Ciaccio, A.M.; lo Sasso, B.; Ciaccio, M. The Value of a Complete Blood Count (CBC) for Sepsis Diagnosis and Prognosis. Diagnostics 2021, 11, 1881. [Google Scholar] [CrossRef]
- Wang, Q.; Bi, S.; Sun, M.; Wang, Y.; Wang, D.; Yang, S. Deep Learning Approach to Peripheral Leukocyte Recognition. PLoS ONE 2019, 14, e0218808. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Khamael, A.-D.; Banks, J.; Nugyen, K.; Al-Sabaawi, A.; Tomeo-Reyes, I.; Chandran, V. Segmentation of White Blood Cell, Nucleus and Cytoplasm in Digital Haematology Microscope Images: A Review—Challenges, Current and Future Potential Techniques. IEEE Rev. Biomed. Eng. 2020, 14, 290–306. [Google Scholar]
- Mohamed, E.H.; El-Behaidy, W.H.; Khoriba, G.; Li, J. Improved White Blood Cells Classification Based on Pre-Trained Deep Learning Models. J. Commun. Softw. Syst. 2020, 16, 37–45. [Google Scholar] [CrossRef] [Green Version]
- Patil, A.M.; Patil, M.D.; Birajdar, G.K. White Blood Cells Image Classification Using Deep Learning with Canonical Correlation Analysis. IRBM 2021, 42, 378–389. [Google Scholar] [CrossRef]
- Basnet, J.; Alsadoon, A.; Prasad, P.W.C.; Aloussi, S.; Alsadoon, O.H. A Novel Solution of Using Deep Learning for White Blood Cells Classification: Enhanced Loss Function with Regularization and Weighted Loss (ELFRWL). Neural Process Lett. 2020, 52, 1517–1553. [Google Scholar] [CrossRef]
- Cheuque, C.; Querales, M.; León, R.; Salas, R.; Torres, R. An Efficient Multi-Level Convolutional Neural Network Approach for White Blood Cells Classification. Diagnostics 2022, 12, 248. [Google Scholar] [CrossRef]
- Sharma, S.; Gupta, S.; Gupta, D.; Juneja, S.; Gupta, P.; Dhiman, G.; Kautish, S. Deep Learning Model for the Automatic Classification of White Blood Cells. Comput. Intell. Neurosci. 2022, 2022, 7384131. [Google Scholar] [CrossRef]
- Jung, C.; Abuhamad, M.; Alikhanov, J.; Mohaisen, A.; Han, K.; Nyang, D. W-Net: A CNN-Based Architecture for White Blood Cells Image Classification. arXiv 2019, arXiv:1910.01091. [Google Scholar]
- Rustam, F.; Aslam, N.; de La Torre Díez, I.; Khan, Y.D.; Mazón, J.L.V.; Rodríguez, C.L.; Ashraf, I. White Blood Cell Classification Using Texture and RGB Features of Oversampled Microscopic Images. Healthcare 2022, 10, 2230. [Google Scholar] [CrossRef] [PubMed]
- Chola, C.; Muaad, A.Y.; bin Heyat, M.B.; Benifa, J.V.B.; Naji, W.R.; Hemachandran, K.; Mahmoud, N.F.; Samee, N.A.; Al-Antari, M.A.; Kadah, Y.M. BCNet: A Deep Learning Computer-Aided Diagnosis Framework for Human Peripheral Blood Cell Identification. Diagnostics 2022, 12, 2815. [Google Scholar] [CrossRef] [PubMed]
- Ahmad, R.; Awais, M.; Kausar, N.; Akram, T. White Blood Cells Classification Using Entropy-Controlled Deep Features Optimization. Diagnostics 2023, 13, 352. [Google Scholar] [CrossRef]
- Bairaboina, S.S.R.; Battula, S.R. Ghost-ResNeXt: An Effective Deep Learning Based on Mature and Immature WBC Classification. Appl. Sci. 2023, 13, 4054. [Google Scholar] [CrossRef]
- Bhojanapalli, S.; Chakrabarti, A.; Glasner, D.; Li, D.; Unterthiner, T.; Veit, A. Understanding Robustness of Transformers for Image Classification. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, BC, Canada, 10–17 October 2021; pp. 10231–10241. [Google Scholar]
- Bazi, Y.; Bashmal, L.; Rahhal, M.M.A.; Dayil, R.A.; Ajlan, N.A. Vision Transformers for Remote Sensing Image Classification. Remote Sens. 2021, 13, 516. [Google Scholar] [CrossRef]
- Chen, H.; Wang, Y.; Guo, T.; Xu, C.; Deng, Y.; Liu, Z.; Ma, S.; Xu, C.; Xu, C.; Gao, W. Pre-Trained Image Processing Transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 12299–12310. [Google Scholar]
- Wu, Y.; Qi, S.; Sun, Y.; Xia, S.; Yao, Y.; Qian, W. A Vision Transformer for Emphysema Classification Using CT Images. Phys. Med. Biol. 2021, 66, 245016. [Google Scholar] [CrossRef] [PubMed]
- Feng, H.; Yang, B.; Wang, J.; Liu, M.; Yin, L.; Zheng, W.; Yin, Z.; Liu, C. Identifying Malignant Breast Ultrasound Images Using ViT-Patch. Appl. Sci. 2023, 13, 3489. [Google Scholar] [CrossRef]
- Ammar, L.B.; Gasmi, K.; Ltaifa, I. Ben ViT-TB: Ensemble Learning Based ViT Model for Tuberculosis Recognition. Cybern. Syst. 2022, 1–20. [Google Scholar] [CrossRef]
- Oztekin, F.; Katar, O.; Sadak, F.; Yildirim, M.; Cakar, H.; Aydogan, M.; Ozpolat, Z.; Talo Yildirim, T.; Yildirim, O.; Faust, O. An Explainable Deep Learning Model to Prediction Dental Caries Using Panoramic Radiograph Images. Diagnostics 2023, 13, 226. [Google Scholar] [CrossRef]
- Lee, H.; Yune, S.; Mansouri, M.; Kim, M.; Tajmir, S.H.; Guerrier, C.E.; Ebert, S.A.; Pomerantz, S.R.; Romero, J.M.; Kamalian, S. An Explainable Deep-Learning Algorithm for the Detection of Acute Intracranial Haemorrhage from Small Datasets. Nat. Biomed. Eng. 2019, 3, 173–182. [Google Scholar] [CrossRef]
- Kouzehkanan, Z.M.; Saghari, S.; Tavakoli, S.; Rostami, P.; Abaszadeh, M.; Mirzadeh, F.; Satlsar, E.S.; Gheidishahran, M.; Gorgi, F.; Mohammadi, S. A Large Dataset of White Blood Cells Containing Cell Locations and Types, along with Segmented Nuclei and Cytoplasm. Sci. Rep. 2022, 12, 1123. [Google Scholar] [CrossRef] [PubMed]
- Wolf, T.; Debut, L.; Sanh, V.; Chaumond, J.; Delangue, C.; Moi, A.; Cistac, P.; Rault, T.; Louf, R.; Funtowicz, M. Transformers: State-of-the-Art Natural Language Processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System demonstrations, Online, 16–20 November 2020; pp. 38–45. [Google Scholar]
- Guo, M.-H.; Liu, Z.-N.; Mu, T.-J.; Hu, S.-M. Beyond Self-Attention: External Attention Using Two Linear Layers for Visual Tasks. IEEE Trans. Pattern. Anal. Mach. Intell. 2022, 45, 5436–5447. [Google Scholar] [CrossRef] [PubMed]
- Wang, L.; He, Y.; Li, L.; Liu, X.; Zhao, Y. A Novel Approach to Ultra-Short-Term Multi-Step Wind Power Predictions Based on Encoder–Decoder Architecture in Natural Language Processing. J. Clean Prod. 2022, 354, 131723. [Google Scholar] [CrossRef]
- Thakur, P.S.; Khanna, P.; Sheorey, T.; Ojha, A. Explainable Vision Transformer Enabled Convolutional Neural Network for Plant Disease Identification: PlantXViT. arXiv 2022, arXiv:2207.07919. [Google Scholar]
- Dosovitskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Dehghani, M.; Minderer, M.; Heigold, G.; Gelly, S. An Image Is Worth 16×16 Words: Transformers for Image Recognition at Scale. arXiv 2020, arXiv:2010.11929. [Google Scholar]
- Lee, S.H.; Lee, S.; Song, B.C. Vision Transformer for Small-Size Datasets. arXiv 2021, arXiv:2112.13492. [Google Scholar]
- Ekanayake, I.U.; Meddage, D.P.P.; Rathnayake, U. A Novel Approach to Explain the Black-Box Nature of Machine Learning in Compressive Strength Predictions of Concrete Using Shapley Additive Explanations (SHAP). Case Stud. Constr. Mater. 2022, 16, e01059. [Google Scholar] [CrossRef]
- Liang, Y.; Li, S.; Yan, C.; Li, M.; Jiang, C. Explaining the Black-Box Model: A Survey of Local Interpretation Methods for Deep Neural Networks. Neurocomputing 2021, 419, 168–182. [Google Scholar] [CrossRef]
- Wang, H.; Wang, Z.; Du, M.; Yang, F.; Zhang, Z.; Ding, S.; Mardziel, P.; Hu, X. Score-CAM: Score-Weighted Visual Explanations for Convolutional Neural Networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, Seattle, WA, USA, 14–19 June 2020; pp. 24–25. [Google Scholar]
- Tavakoli, S.; Ghaffari, A.; Kouzehkanan, Z.M.; Hosseini, R. New Segmentation and Feature Extraction Algorithm for Classification of White Blood Cells in Peripheral Smear Images. Sci. Rep. 2021, 11, 19428. [Google Scholar] [CrossRef] [PubMed]
- Katar, O.; Kılınçer, İ.F. Automatic Classification of White Blood Cells Using Pre-Trained Deep Models. Sak. Univ. J. Comput. Inf. Sci. 2022, 5, 462–476. [Google Scholar] [CrossRef]
- Akalın, F.; Yumuşak, N. Detection and Classification of White Blood Cells with an Improved Deep Learning-Based Approach. Turk. J. Electr. Eng. Comput. Sci. 2022, 30, 2725–2739. [Google Scholar] [CrossRef]
- Leng, B.; Wang, C.; Leng, M.; Ge, M.; Dong, W. Deep Learning Detection Network for Peripheral Blood Leukocytes Based on Improved Detection Transformer. Biomed. Signal Process. Control 2023, 82, 104518. [Google Scholar] [CrossRef]
Phase | Basophil | Eosinophil | Lymphocyte | Monocyte | Neutrophil | Total |
---|---|---|---|---|---|---|
Training | 241 | 852 | 2887 | 637 | 8688 | 13,305 |
Validation | 30 | 107 | 361 | 79 | 1087 | 1664 |
Testing | 30 | 107 | 361 | 79 | 1087 | 1664 |
Total | 301 | 1066 | 3609 | 795 | 10,862 | 16,633 |
Layer Name | Input Shape | Output Shape |
---|---|---|
PatchEmbed | (1, 3, 224, 224) | (1, 196, 768) |
Conv2D (proj) | (1, 3, 224, 224) | (1, 768, 14, 14) |
Idenity (norm) | (1, 196, 768) | (1, 196, 768) |
Dropout | (1, 197, 768) | (1, 197, 768) |
Idenity (patch_drop) | (1, 197, 768) | (1, 197, 768) |
Idenity (norm_pre) | (1, 197, 768) | (1, 197, 768) |
Encoder Block-1 | (1, 197, 768) | (1, 197, 768) |
LayerNorm (norm1) | (1, 197, 768) | (1, 197, 768) |
Attention | (1, 197, 768) | (1, 197, 768) |
Idenity (ls1) | (1, 197, 768) | (1, 197, 768) |
Idenity (drop_path1) | (1, 197, 768) | (1, 197, 768) |
LayerNorm (norm2) | (1, 197, 768) | (1, 197, 768) |
MLP | (1, 197, 768) | (1, 197, 768) |
Idenity (ls2) | (1, 197, 768) | (1, 197, 768) |
Idenity (drop_path2) | (1, 197, 768) | (1, 197, 768) |
Encoder Block-2 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-3 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-4 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-5 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-6 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-7 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-8 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-9 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-10 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-11 | (1, 197, 768) | (1, 197, 768) |
Encoder Block-12 | (1, 197, 768) | (1, 197, 768) |
LayerNorm (norm) | (1, 197, 768) | (1, 197, 768) |
Idenity (fc_norm) | (1, 768) | (1, 768) |
Dropout | (1, 768) | (1, 768) |
Linear (head) | (1, 768) | (1, 5) |
Study | Year | Number of Class | Method | Explainability | Performance |
---|---|---|---|---|---|
Tavakoli et al. [40] | 2021 | 5 (Basophil, Eosinophil, Lymphocyte, Monocyte, Neutrophil) | SVM | Black-box | Acc = 94.65% |
Katar and Kilincer [41] | 2022 | 5 (Basophil, Eosinophil, Lymphocyte, Monocyte, Neutrophil) | CNN | Grad-CAM | Acc = 98.86% |
Akalin and Yumusak [42] | 2022 | 5 (Basophil, Eosinophil, Lymphocyte, Monocyte, Neutrophil) | Hybrid | Black-box | Acc = 98.00% |
Leng et al. [42] | 2023 | 3 (Eosinophil, Monocyte, Neutrophil) | DETR | Black-box | mAP = 96.10% |
The proposed study | 2023 | 2 (Granulocytes and Agranulocytes) | ViT | Score-CAM | Acc = 99.70% |
5 (Basophil, Eosinophil, Lymphocyte, Monocyte, Neutrophil) | Acc = 99.40% |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Katar, O.; Yildirim, O. An Explainable Vision Transformer Model Based White Blood Cells Classification and Localization. Diagnostics 2023, 13, 2459. https://doi.org/10.3390/diagnostics13142459
Katar O, Yildirim O. An Explainable Vision Transformer Model Based White Blood Cells Classification and Localization. Diagnostics. 2023; 13(14):2459. https://doi.org/10.3390/diagnostics13142459
Chicago/Turabian StyleKatar, Oguzhan, and Ozal Yildirim. 2023. "An Explainable Vision Transformer Model Based White Blood Cells Classification and Localization" Diagnostics 13, no. 14: 2459. https://doi.org/10.3390/diagnostics13142459
APA StyleKatar, O., & Yildirim, O. (2023). An Explainable Vision Transformer Model Based White Blood Cells Classification and Localization. Diagnostics, 13(14), 2459. https://doi.org/10.3390/diagnostics13142459