scieee AI-readable full text Open interactive document viewer

A pre-trained convolutional neural network with optimized capsule networks for chest X-rays COVID-19 diagnosis

AbouEl-Magd, Lobna M.

Abstract

Coronavirus disease (COVID-19) is rapidly spreading worldwide. Recent studies show that radiological images contain accurate data for detecting the coronavirus. This paper proposes a pre-trained convolutional neural network (VGG16) with Capsule Neural Networks (CapsNet) to detect COVID-19 with unbalanced data sets. The CapsNet is proposed due to its ability to define features such as perspective, orientation, and size. Synthetic Minority Over-sampling Technique (SMOTE) was employed to ensure that new samples were generated close to the sample center, avoiding the production of outliers or changes in data distribution. As the results may change by changing capsule network parameters (Capsule dimensionality and routing number), the Gaussian optimization method has been used to optimize these parameters. Four experiments have been done, (1) CapsNet with the unbalanced data sets, (2) CapsNet with balanced data sets based on class weight, (3) CapsNet with balanced data sets based on SMOTE, and (4) CapsNet hyperparameters optimization with balanced data sets based on SMOTE. The performance has improved and achieved an accuracy rate of 96.58% and an F1- score of 97.08%, a competitive optimized model compared to other related models.

Full text

A pre-trained convolutional neural network with optimized capsule networks for chest X-rays COVID-19 diagnosis Lobna M. AbouEl-Magd 1,5 •Ashraf Darwish 2,5 •Vaclav Snasel 3 •Aboul Ella Hassanien 4,5 Received: 19 December 2021 / Revised: 22 June 2022 / Accepted: 3 August 2022 The Author(s) 2022 Abstract Coronavirus disease (COVID-19) is rapidly spreading worldwide. Recent studies show that radiological images contain accurate data for detecting the coronavirus. This paper proposes a pre-trained convolutional neural network (VGG16) with Capsule Neural Networks (CapsNet) to detect COVID-19 with unbalanced data sets. The CapsNet is proposed due to its ability to define features such as perspective, orientation, and size. Synthetic Minority Over-sampling Technique (SMOTE) was employed to ensure that new samples were generated close to the sample center, avoiding the production of outliers or changes in data distribution. As the results may change by changing capsule network parameters (Capsule dimensionality and routing number), the Gaussian optimization method has been used to optimize these parameters. Four experiments have been done, (1) CapsNet with the unbalanced data sets, (2) CapsNet with balanced data sets based on class weight, (3) CapsNet with balanced data sets based on SMOTE, and (4) CapsNet hyperparameters optimization with balanced data sets based on SMOTE. The performance has improved and achieved an accuracy rate of 96.58% and an F1score of 97.08%, a competitive optimized model compared to other related models. Keywords COVID-19 Coronavirus Convolution neural networks Capsule Neural Networks VGG16  Gaussian optimization method 1 Introduction Coronavirus (COVID-19), which originated in December 2019 at Wuhan Province of the People’s Republic of China, presents a severe and deadly threat to health worldwide. COVID-19 has infected more than 8,963,350 people in 188 countries, and the aggregate of people who died is increasing [1]. There are several medical ways of diagnosing COVID-19. Chest radiography is the preferred imaging method for people infected with COVID-19 because it is easily accessible, cheap, and easy to clean and disinfect [2]. The most common radiographic findings are the airspaces’ opacity, described as a fusion, or, less commonly, the Earth’s glass’s opacity. The distribution of COVID-19 is often binomial, circumferential, and inferior [2]. Convolutional Neural Network (CNN) has important medical image analysis and processing applications. The results of CNN show that it can translate image data to a precise and expected output [3,4]. Furthermore, Deep learning-based chest X-rays can also diagnose diseases &Aboul Ella Hassanien [email protected] Lobna M. AbouEl-Magd [email protected] Ashraf Darwish [email protected] Vaclav Snasel [email protected] 1 Computer Science Department, Misr Higher Institute, Mansoura, Egypt 2 Faculty of Science, Helwan University, Helwan, Egypt 3 VSB-Technical University of Ostrava, Ostrava, Czech Republic 4 Faculty of Computers and AI, Cairo University, Giza, Egypt 5 Scientific Research Group in Egypt (www.egyptscience.net), Giza, Egypt 123 Cluster Computing https://doi.org/10.1007/s10586-022-03703-2(0123456789().,-volV)(0123456789().,-volV) faster than traditional methods. Several authors used CNN for medical applications in their research papers. For instance, authors in [5] and [6] used the CNN-based CheXNet model for chest diseases. Some researchers use pre-trained CNN. For example, in [7], the authors used pre-trained ResNet-50 architecture named COVID ResNet. The input layer, the group of hidden layers, and the output layer are the three primary layers of a CNN. Convolutional, pooling, fully linked, and normalization layers are also included in the hidden layers. When it comes to image-related operations, CNN excels. They do, however, have some inherent limitations and flaws. CNN, for example, fails to capture relative spatial and orientation relationships and is easily confused by changes in image orientation or pose. The max-pooling layer is critical because it downsamples the data and decreases the spatial information given to the next layer. On the other hand, the max-pooling layer has a disadvantage for CNN because it cannot convey spatial hierarchies across various objects. This flaw causes invariance, and the pose and spatial. Although CNNs perform well in dealing with images, they still have a set of shortcomings. The aggregation process used in convolutional neural networks suffers from losing valuable information when using aggregation layers. In addition, they require huge amounts of data for learning. Layering in a CNN reduces spatial resolution, and the networks’ output never changes even with a small amount of change in the input. It cannot be directly related to the relationship of parts and requires additional components. This is where Capsule Networks comes into play and overcomes all the drawbacks of CNN. Capsule networks (CapsNet) can fetch spatial information to overcome information loss in aggregations [8]. CapsNet is a novel type of neural network presented in [9], which introduced a ‘‘capsule’’ concept. A capsule is a bunch of neurons. Each layer in a capsule network has several capsules. The Capsule’s outputs have different properties of the same entity. The traditional CNN is based on the vision system’s use of the same knowledge at all locations within an image. This is often accomplished by linking feature detector weights to make features learned in one location available in others. Convolutional capsules extend knowledge sharing across sites to include the partwhole relationships that characterize the familiar form. This is achieved when a layer’s position matrix is multiplied by a trainable viewpoint static transformation matrix that can learn to represent part-to-total relationships, capsule votes for the position matrix of several capsules above it in that layer [10]. The Capsule has hyperparameters that affect its algorithm’s complexity and accuracy of a given problem [11]. These hyperparameters are the number of routing and capsule dimensionality. Many optimization algorithms can be used to get optimal hyperparameter values. This paper proposes a new model that uses pre-trained CNN VGG16 with a CapsNet to detect COVID-19. The accuracy of the proposed model is enhanced by using the Gaussian optimization process to tune the hyperparameters of the Capsule neural networks (CapsNet). The main contribution of this paper is summarized as follows. •Handling the balancing and the small number of images on the benchmark database as two problems may impact the detection and classification results •Pre-trained the model is used for deep feature extraction using VGG16 as input for the CapsNet. •Detection of COVID-19 detection model based on pretrain VGG16 with Capsule Networks •Applying Gaussian optimization for CapsNet hyperparameter optimization This paper is organized as follows. Section 2reviews related works. Section 3focuses on the preliminaries and basics, whereas Sect. 4presents the materials and methods. Furthermore, Sect. 5describes the experimental results and analyzes the results and performance of the proposed model. Finally, Sect. 6has the conclusion and highlights future work. 2 Related works Artificial intelligence has been used to recognize and classify lung diseases in recent decades. Research has varied between image feature extraction, suitable image recognition, and disease identification classifiers. For example, Patil in [12] classified Lung cancer based on a texture features extraction and the backpropagation neural network. The retrieved features were average grey level, standard deviation, smoothness, the third moment, uniformity, and entropy. Furthermore, an accuracy of 83 percent was obtained. The authors used multilayer, probabilistic, learning vector quantization, and generalized regression neural networks to achieve a comparative chest illness diagnosis [13]. They demonstrated that the probabilistic neural network performed better. The spread of the coronavirus has been a great danger since its outbreak in Wuhan in December 2019. This virus has a real worldwide disastrous impact, as the number of deaths reached 2,624,677 and confirmed cases 118,268,575 in about 223 countries, according to the reports of the World Health Organization on March 12, 2021 [14]. This motivated many researchers to identify this dreaded disease and limit its spread. Cluster Computing 123 Pereira et al. in [15] created RYDLS-20, a database of CXR images of pneumonia and healthy lungs. They used multiclass and hierarchical classification and resampling algorithms to deal with an unbalanced data set. They compare and use different feature extraction algorithms for extracting features from the image, such as binarized statistical image features (BSIF), local binary patterns (LBP), local directional number pattern (LDN), elongated quinary patterns (EQP), local phase quantity (LPQ), and Basic Oriented Image Features OBIF. The suggested technique yielded an average F1 score of 0.65 using a multiclass approach in the hierarchical classification scenario and an F1 score of 0.89 for COVID-19 identification. Tej Bahadur Chandra et al. [16] employed a variety of ways to extract features from images and then used binary grey wolf optimization to select the best ones. Their study performs classification in two phases. The first phase distinguishes between normal and abnormal chest images. The second phase (phase II) distinguishes pneumonia and Covid-19 chest images. Additionally, the voting-based classifier ensemble is used for classification. The majority vote-based classifier ensemble in phase (I) gave 98.062% accuracy and 98.55for the F1 score, and phase II gave 91.32% accuracy and 91.73 for the F1 score. Furthermore, the majority vote-based classifier ensemble gave an overall accuracy of 93.41%. CNN has been used in many types of research for detecting the COVID-19. For example, Asmaa Abbas et al. [17] used a deep CNN called decompose, transfer, and compose to detect COVID-19 X-ray pictures (DeTraC). They demonstrated DeTraC’s competence in detecting COVID-19 with a 93.1% accuracy. Any anomalies in the picture dataset are dealt with utilizing a class decomposition approach by DeTraC. O. M. Elzeki et al. [18] proposed a CXR COVID Network (CXRVN) network. CXRVN is a compact architecture based on a single fully-connected node. The CXRVN uses Mini-batch gradient descent and Adam optimizer. The authors used three datasets to test their model. Dataset-1 comprises two class labels and 50 X-ray images, and the test accuracy was 92.85%. Additionally, Dataset-2 comprises two class labels and 455 X-ray images with 96.70% accuracy. Furthermore, Dataset-3 comprises three class labels and 603 X-ray images, and the accuracy was 91.70%. Moreover, they used generative adversarial networks (GAN) augmentation, giving 96.7% accuracy in Dataset-2 for two classes and 93.07% in Dataset-3 for three classes. The average accuracy reached 94.5%. M.Nour et al. [19] used CNN for extracting discriminative features and different machine learning approaches for classification. The hyperparameters of their models were optimized using the Bayesian optimization algorithm. The support vector machines classifier ensured the most efficient results with 98.97% accuracy and 96.72% F1score. Some researchers used pre-train CNN models and transferred learning for COVID-19 detection to get more accurate results. M. M. Rahaman et al. used deep transfer learning to compare 15 pre-trained CNN models. The VGG19 had an F1 score of 0.90 and an accuracy of 89.3% [20]. Arun Sharma et al. [21] Used transfer learning to build AI-based classification models, CXR pictures depicting the investigated diseases may be accurately classified. They performed 25 different augmentations on the original pictures to increase the dataset. They then used a transfer learning method to train and test their models. After training 286 images in each of the two best models, combining them produced the maximum prediction accuracy for the normal, COVID, non-COVID, and pneumonia/tuberculosis shots. For binary (COVID vs. No-Findings) and multiclass classification (COVID vs. No-Findings vs. Pneumonia), Tulin Ozturk et al.[22] introduced the DarkNet model. Binary classification accuracy was 98.08%, while multiclass classification accuracy was 87.02% for their model. In [23], D. Ezzat et al. proposed an optimized hybrid CNN. The used CNN architecture is DenseNet121, and the optimization algorithm is the gravitational search algorithm (GSA). The GSA is used to determine the most appropriate values for the hyperparameters of the DenseNet121 architecture. Their accuracy reached 98.38% In [24], Hossein Abbasimehr et al. suggested a method to forecast COVID-19 time series using three deep learning techniques: (1) LSTM, (2) gated recurrent units, and (3) CNN. The suggested strategy considerably increases the performance of LSTM and CNNs in terms of symmetric mean absolute percentage error and root mean square error measurements. Table 1shows the relevant work on COVID-19 diagnosis from chest X-ray radiographs; we can see from this Table that the performance of the majority of the pieces is poor, especially in multiclass work, except Nour et al. [19], where the f1-score is lower than the accuracy. As a result, we were motivated to increase the accuracy of multiclass classification by employing a capsule network, which is concerned with collecting the pose and spatial interactions between image pixels. 3 Preliminaries 3.1 Capsule neural networks CNN is currently used in many applications and has shown satisfactory results in these applications’ classification and Cluster Computing 123 prediction processes. However, CNN performs poorly in recognizing position, texture, and distortions of an image or parts of an image. This implies that the CNNs are invariant. The pooling phase in CNN may produce invariance. CNN’s are not equivariant and thus lack equivalence. Furthermore, some images’ features are lost due to the pooling operation on CNN. Consequently, CNNs are being supplanted by capsule networks. Unlike CNN, capsules are equivariant and consist of a network of neurons that input and output vectors rather than the scalar values. This capsule property allows it to learn the image’s deformations, viewing conditions, and features [25,26]. Capsule networks are made up of layers of capsules. Each Capsule comprises a collection of neurons whose output represents a distinct aspect of the same feature. CapsNet was introduced in [9], where the Capsule is defined as a set of neurons with activity vectors representing instantiation parameters and the length of the vector, signifying the likelihood of the feature existing. The CapsNet model used in this paper consists of 3 main successive layers, as shown in Fig. 1, including the convolutional layer, primary capsule (PC), and class capsule layers named digit caps layer [9]. The first layer (convolutional layer) is responsible for image feature extraction, where the image’s pixel is converted to spatial information. The output of the convolution layer enters the PC layer. The PC layer may act as though the rendering process was reversed. An image’s information can be divided into numerous units under several channels to generate a vector of reserved spatial data for each unit. It reaches the class capsule’s next layer of neurons. This innovative network structure replaces the pooling layer in a normal convolutional network, reducing information loss significantly [9,27,28]. An overview of how the capsule network works is as follows. Layer l, each Capsule ihas an activity vector o i that encodes spatial information in instantiation parameters. The ith lower-level capsule’s output vector o i is supplied to all capsules in the next layer l ?1. At layer l ?1, the jth Capsule will receive o i and locate its product using the weight matrix W ij . The ^ o j|i vector transforms Capsule j at level l ?1 by Capsule iat level l. ^ o j|i is a PC’s prediction vector showing how much the primary Capsule i contributes to class j. ^ oji j¼Wijoið1Þ Table 1 Summary and analysis of the related works Paper Method Classes Performance Rodolf M.Pereira et al. [15] Use different feature extraction algorithms Multiclass The multiclass F1-score was 0.65, and the hierarchical classification F1-score was 0.89 M. M. Rahaman et al. [20] VGG19 Multiclass Accuracy was 89.3%, and F1 score was 0.90 Asmaa Abbas et al.[17] Deep CNN Binary class Accuracy was93.1% Tej Bahadur Chandra et al. [16] Used different feature extraction techniques and used binary gray wolf optimization for feature selection. Also, used voting-based classifier ensemble is used Distinguishes between normal and abnormal chest images and distinguishes between pneumonia, and the Covid-19 chest Phase (I) gave 98.062% accuracy and 98.55 for the F1-score, and phase II gave 91.32% accuracy and 91.73 for F1 score The majority vote-based classifier ensemble gave an overall accuracy of 93.41% O. M. Elzeki et al. [18] proposed a network architecture called CXR COVID Multiclass - Accuracy was 96.7% - Accuracy was 93.070% M.Nour et al. [19] Suggested model based on CNN Multiclass Accuracy was 98.97% and an F1score was 96.72% Tulin Ozturk et al.[22] proposed the DarkNet model binary classification multiclass classification The binary class accuracy was 98.88%, while the multiclass accuracy was 87.02% Dalia [23] DenseNet121 The gravitational search algorithm is used to determine the best values for the hyperparameters of the DenseNet121 architecture Accuracy 95% Cluster Computing 123 One main capsule i’s prediction for class capsule j is made by multiplying its prediction vector by its coupling coefficient, which measures the degree of agreement between the two caps. They are linked as long as there is a significant degree of agreement between the two capsules. As a result, the coupling coefficient will increase rather than decrease as would occur if the opposite occurred. To find the squashing function candidates, a weighted sum (ws j ) of all these individual PC predictions for the class capsule j is produced (q j ). wsj¼XN i¼1cij ^ oji jð2Þ qj¼wsj    2 1þwsj    2 wsj wsj    ð3Þ cij ¼expðbijÞ PkexpðbijÞð4Þ The squashing function, like a likelihood, assures that the length of the output from the Capsule is between 0 and 1. The q j from one capsule layer is passed on to the next capsule layer, where it is treated the same way as before. The c ij coupling coefficient ensures that the level l prediction of I is linked to the layer l ?1 prediction of j. The dot product of o ˆ j|i and qj is obtained during each cycle, and c ij is updated. The vector values of each Capsule may be thought of as a combination of two numbers: a probability indicating the presence of the feature encapsulated by the Capsule and a set of instantiation parameters that can be used to explain layer consistency. The term ‘‘relevant path by agreement’’ comes from the fact that when lower-level capsules agree on a higher-level layer capsule, they ‘‘construct a part-whole’’ relationship demonstrating path relevance. Dynamic routing-by-agreement is the name for this approach [9,10,25]. Capsule networks suffer from expensive computational methods, yet numerous routing layers increase training costs and inference time because of the complexity of the network [29]. Researchers in [24] have, on the other hand, demonstrated that the prediction time is significantly shorter than that of other deep learning techniques. In this research, the optimization strategy focuses on the number of routing to get high performance with minimal complexity. 3.2 VGG16 architecture VGG16 is a CNN model introduced in [30]. VGG-16 includes 16 layers, 13 of which are convolutional and three of which are fully linked. Five blocks comprise the convolutional layers. The model uses only filters of size 3 93 with one stride for convolutions and 2 92 pooling with two strides in all layers, resulting in a homogenous and smooth architecture. The pre-trained VGG16 model can classify images into 1000 object categories with million images. It got an accuracy of about 92.7% in the accuracy test for the ImageNet dataset—VGG16 improves other CNN models like AlexNet. The NVIDIA Titan Black GPU has been used for training the VGG16 [30]. Figure 2shows the VGG16 architecture. 3.3 Gaussian optimization algorithm The Gaussian process (GP) is specified by its mean and covariance functions. It can be written as: FðxÞgpðmðkÞ;Kðk;kÞÞ ð5Þ where m(k) denotes mean, and K denotes covariance [31]. The Bayesian model is a simple example of a GP, and the Bayesian optimization method is one of the general optimization methods; the optimization method is an iterative algorithm. A probabilistic surrogate model element of the Gaussian optimization approach and an acquisition function determining the next point to be assessed are included. The surrogate model fits all target function observations thus far in each cycle. The assemblage function estimates the utility of candidate nodes using the probabilistic model’s prediction distribution. Rather than assessing costly efforts, the importance of acquisitions is calculating and optimizing them [26,31]. The expected improvement (EI) is based on Eq. (6) and is the acquisition function. Fig. 1 Capsule network architecture Cluster Computing 123 E[I(k)] = E[max(fmin Y, 0)] ð6Þ where (EI) is computed in the closed-form if the prediction of the Model Y at configuration kaccording to a normal distribution is defined using Eq. (7). E½IðkÞ ¼ ðfmin lðkÞÞUfmin lðkÞ r  þr/ fmin lðkÞ r  ð7Þ where u() is the standard normal density, U()s the standard normal distribution function, and f min is the best-observed value. 3.4 Synthetic minority over-sampling technique (SMOTE) Machine learning algorithms are usually evaluated based on their predictive accuracy. The dataset is imbalanced if the classes are not roughly equally represented. When the data is uneven, this is ineffective. The data-level technique aims to rebalance the minority and majority classes by modifying the data. This can be done by either removing some examples from the majority class (under-sampling) or increasing the number of cases from the minority class (over-sampling) (over-sampling). SMOTE is an over-sampling method that uses ‘‘synthetic’’ instances rather than replacement oversampling to over-sample the minority class [32]. 4 The proposed pre-trained CNN with optimized CapsNet for chest X-Ray COVID-19 diagnoses The proposed COVID-19 detection model mainly includes four phases, as shown in Fig. 3: data preprocessing, pretrained, classification and optimization, and evaluation phases. Each of these phases is explained in the following subsections. 4.1 Data preparation phase Overfitting occurs when a network learns a function with a high variance to model the training data successfully. This phase implemented three key steps: splitting data into training and testing sets, data augmentations, and balancing the dataset. Due to its novelty, we discovered two issues with the entire dataset. The first problem is that there are few data points, and the second is that the data is unbalanced. The medical dataset only contains a few photos, whereas deep learning algorithms require a large amount of data to avoid overfitting. There are many ways and techniques to avoid overfitting (raised from the small dataset); one of them and the most used is data augmentation. We used the image data augmentation methods, such as rotating right with 30 degrees, left with 30 and ?90 degrees up and horizontally about Y-axis, and shear in this work. We employ two approaches to deal with the unbalanced dataset. The first one is based on the class weight based on costly errors. The cost error value will be included in the probability for each class. The second approach is using SMOTE technique based on over-sampling. It involves multiplying select points from the minority class to broaden their origin. Another issue in the preprocessing phase is splitting the dataset into training and testing datasets with 70% and 30% ratios. 4.2 Pre-trained and CapsNet optimization phases The training process is divided into the following three steps. Step (1): Pre-train CNN VGG16 Architecture: generally, the elementary features can be extracted on CNN. The elementary feature may be edges and corners. The extracted features are aggregated in the next layers to detect higher-order features. CNN has another essential Fig. 2 The architecture of the pre-trained VGG16 Cluster Computing 123 property; this property shares weights meaning that similar feature detectors are utilized for the whole object. CNN has many layers known as ‘‘sub_sampling’’ layers. The ‘‘sub_sampling’’ layers depend on the fact that the features’ exact location is useful and destructive since this dataset tends to vary for different images or objects [33]. Transfer learning from a pre-trained model like VGG16 extracts the in-depth features. The image is input to the pretrained network, and the activation values for different layers are stored and utilized as features [34]. The VGG16 consists of five blocks that help get similar features instantly. So, VGG16 will be used on the recent new architecture called CapsNet introduced in [9]. Figure 4 shows the visualization of VGG16 output. Step (2): Capsule network (COVID-caps): The X-ray image of COID-19 differs from the normal image because it contains white spots on the lung; also, it differs from the viral pneumonia image due to the location, whereas in covid-19, these spots spread at the bottom of the lung more, i.e., the area of the spots contributes to identifying COVID19. Instead of neurons CapsNet is made up of capsules. As defined in [35], the Capsule can be a collection of neural networks. It could carry out complex internal calculations on their inputs and store the results in a tiny vector. The Capsule records the relative position of the item, and if the object’s pose changes, the output vector orientation also changes. CapsNet is made up of several layers. The first layer is called PCs, consisting of individual capsules that each receives a small portion of the receptive field as input and attempt to determine the pose of a specific pattern. The Capsule output is a vector, and a dynamic routing mechanism was employed to ensure that the result was sent to the appropriate parent in the layer, which could be deduced. The CapsNet architecture consists of two layers. (i) The PC layer is the first layer of the CapsNet that follows the pre-train model. It is a convolutional capsule layer that contains 32 channels of convolutional 10 D capsules. Each PC has ten convolutional units with a (9 99) kernel, and the number of the strides is 2. (ii) COVID-caps capsule layer contains three capsules, denoted as ‘‘COVID-caps,’’ and one candidate of lung disease (COVID-19, viral pneumonia, or normal). The COVID capsule layer consists of 10 capsules, each representing a particular class of the lung disease dataset with three. The initial dimension used for these capsules is 16. Computed Fig. 3 The proposed COVID-19 prediction model using Optimized CapsNet Fig. 4 Visualization of VGG16 output Cluster Computing 123 COVID-caps capsules’ output calculates the predicted output vectors for each primary COVID-caps capsule pair and implements the route by agreement algorithm. Margin loss for lung diseases is the length of the instantiation output vector representing the probability of the respective Capsule’s entity existence. For every disease_kind Capsule Co, the margin loss is separate and is given in Eq. (8). The disease class Co has the most prolonged vector output if the lung disease is present in the input image. LCo ¼TCo maxð0;mrþVCo kkÞ 2þkð1 TCoÞmaxðð0;VCo jjjj mrÞ2ð8Þ The value of T Co is 1 if a lung disease of class Co is present, and in this study mr ? = 0.9 and mr - = 0.1. kis a regularization parameter that stops learning from shrinking all lung disease capsules [10]. Figure 5presents the visualization of the CapsNet. The disease spots are visible in Fig. 5a for Coivd-19 disease and Fig. 5(b) for viral pneumonia. The accuracy is computed as the correctly identified lung disease ratio by the total number of lung diseases. Accuracy = RCorrect identified lung diseases Total number of lung diseases ð9Þ Step (3): CapsNet hyperparameter optimization: Hyperparameter optimization is a way to find a Ddimension hyperparameter setting x that minimizes the validation loss/error f of the CapsNet learned with. The function f maps a hyperparameter choice xof Gconfigurable hyperparameters to a CapsNet algorithm’s validation error with learned parameters [36]. Optimizing f, as shown in Eq. 10, suggests a solution for finding out the optimal hyperparameters automatically: minx2RGfðx;h;SvalÞ s:t:h¼arg min hfðh;StrainÞð10Þ Solving the problem in Eq. (10) is quite challenging due to the incredible complexity of the function f. Where S train denotes the training dataset, and Sval represents the validation dataset. The learning process reduces the training loss/error, and the value of xis in a bounded set. The GP is one of the Bayesian optimization algorithms. Bayesian optimization algorithms use a cheap probabilistic surrogate model to approximate the expensive error function. Consequently, we use the GP to optimize the hyperparameters of the CapsNet. Algorithm (1) shows the detailed steps of the COVID-19 CapsNet Detection Model. (a) COVID-19 (b) Viral pneumonia Fig. 5 CapsNet visualization. aCOVID-19. bViral pneumonia Cluster Computing 123 5 Experimental results The experiments were performed using tensor flow and Keras with a TPU google COLAB environment. 5.1 Dataset The COVID-19 Chest X-ray images used in this study are from the Italian Society of Medical and Interventional Radiology and are named the SIRM dataset. The dataset is hosted at Kaggle [37] and contains healthy instances, viral pneumonia, and COVID-19 patients. It contains 219 positive images for COVID-19, 1341 standard images, and 1345 images for viral pneumonia. The images are in portable network graphics file format with a 1024 91024 pixels resolution. The dataset is not balanced and may need some effort to balance before using the deep learning-based COVID-19 detection. Figure 6shows samples of the training and testing images for the three classes. Panel Type (row-1) illustrates the COVID-19 infected, panel (row-2) shows viral pneumonia, and panel (row-3) illustrates healthy instances. 5.2 Evaluation measures The proposed model capacity is evaluated based on the accuracy (Acc), precision (P), recall (R), and F1 score. Accuracy is the percentage of true predictions from all forecasts made, calculated by Eq. (11), precision assesses a model’s ability to predict values for a specific category correctly, and it is calculated using Eq. (12), recall is calculated as the fraction of correctly classified positive patterns in Eq. (13). At the same time, F1 score is the weighted average of precision and recall calculated based on Eq. (14). Acc = (TP + TN)/(TP + FP + FN + TN) ð11Þ P¼TP=ðTP þFPÞð12Þ Cluster Computing 123