Citation: Akinyelu, A.A.; Bah, B. COVID-19 Diagnosis in Computerized Tomography (CT) and X-ray Scans Using Capsule Neural Network. Diagnostics 2023, 13, 1484. https://doi.org/10.3390/ diagnostics13081484 Academic Editor: Maurizio Marrale Received: 28 February 2023 Revised: 14 April 2023 Accepted: 14 April 2023 Published: 20 April 2023 Copyright: © 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/). diagnostics Article COVID-19 Diagnosis in Computerized Tomography (CT) and X-ray Scans Using Capsule Neural Network Andronicus A. Akinyelu 1,2, * and Bubacarr Bah 1,3 1 Research Centre, African Institute for Mathematical Sciences (AIMS) South Africa, Cape Town 7945, South Africa 2 Department of Computer Science and Informatics, University of the Free State, Phuthaditjhaba 9866, South Africa 3 Department of Mathematical Sciences, Stellenbosch University, Cape Town 7945, South Africa * Correspondence: akinyeluaa@ufs.ac.za Abstract: This study proposes a deep-learning-based solution (named CapsNetCovid) for COVID-19 diagnosis using a capsule neural network (CapsNet). CapsNets are robust for image rotations and affine transformations, which is advantageous when processing medical imaging datasets. This study presents a performance analysis of CapsNets on standard images and their augmented variants for binary and multi-class classification. CapsNetCovid was trained and evaluated on two COVID-19 datasets of CT images and X-ray images. It was also evaluated on eight augmented datasets. The results show that the proposed model achieved classification accuracy, precision, sensitivity, and F1-score of 99.929%, 99.887%, 100%, and 99.319%, respectively, for the CT images. It also achieved a classification accuracy, precision, sensitivity, and F1-score of 94.721%, 93.864%, 92.947%, and 93.386%, respectively, for the X-ray images. This study presents a comparative analysis between CapsNetCovid, CNN, DenseNet121, and ResNet50 in terms of their ability to correctly identify randomly transformed and rotated CT and X-ray images without the use of data augmentation techniques. The analysis shows that CapsNetCovid outperforms CNN, DenseNet121, and ResNet50 when trained and evaluated on CT and X-ray images without data augmentation. We hope that this research will aid in improving decision making and diagnostic accuracy of medical professionals when diagnosing COVID-19. Keywords: COVID-19 diagnosis; medical imaging; capsule neural network; machine learning; CT scans 1. Introduction Coronavirus disease 19 (COVID-19), one of the deadliest pandemics in the history of mankind, has swept through almost all the countries in the world [1]. Coronavirus has infected over 676 million people and killed over 6.88 million as of 17 March 2023, as indicated in the COVID-19 map of Johns Hopkins University. Unfortunately, the virus is still evolving, and new variants continue to emerge worldwide. Multiple nations, including Australia, Bangladesh, Denmark, India, Japan, and the United States, detected a novel immune-evasive COVID-19 strain (XBB) in August 2022, which is causing outbreaks in various nations. This shows that COVID-19 is still a threat, and there is a need for suitable techniques that can be used to tackle this pandemic. Recently, computer-aided diagnosis technologies have become a fundamental part of routine clinical practice. These tools can be utilized to aid physicians in accurately diagnosing COVID-19 patients. Convolutional neural networks (CNNs) are one of the effective deep learning (DL) algorithms for building improved medical imaging systems. However, they are unable to handle input transformations effectively. In addition, CNNs must be trained on massive or augmented datasets to generate superior results. A capsule neural network (CapsNet) is a recent deep learning (DL) algorithm proposed by Hinton Diagnostics 2023, 13, 1484. https://doi.org/10.3390/diagnostics13081484 https://www.mdpi.com/journal/diagnostics