Introduction

COVID-19 is a global pandemic. It has rapidly become a severe public health-related problem worldwide. COVID-19 is a zoonotic infection that is believed to be transmitted from bats to humans [1, 2]. Mild symptoms of COVID-19 appear in 82% of the cases. Out of 93,194,922 worldwide COVID-19 cases, 20,014,729 led to death [3]. The major symptoms are cough, fever, and dyspnea. In severe cases, it can cause pneumonia, septic shock, failure of multiple organs, and even death. The infection rate is higher in males compared to females. No death was reported among children 0–9 years old [4]. Based on the latest published guidelines by the Chinese government, COVID-19 diagnosis is confirmed through gene sequencing of the blood, RT-PCR of the respiratory samples, a key indicator for hospitalization. Currently, the low sensitivity of RT-PCR leads to several COVID-19 cases going unidentified which can in turn prohibit them from getting the proper treatment [5, 6]. The COVID-19 virus is highly infectious and can spread quickly especially when diagnosed late. The delay in diagnosis and medical treatment can lead to a severe stage of pneumonia, and permanent lung damage that reduces the patient’s survival rate [7]. According to the World Health Organization, COVID-19 may cause permanent lung parenchymal damage, similar to SARS, with a honeycomb-like appearance. It can also cause damage to various organs in the human body. It is believed to spread through infected droplets produced by coughing and exhaling. Computed tomography (CT) is a non-invasive imaging technique for detecting lung involvement and determining the severity of COVID-19 [8].

Artificial intelligence (AI) approaches are commonly used for the analysis of medical imaging [9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]. Deep learning (DL) methodologies extract high-level features in the form of a pipeline that learns complicated patterns. The inceptionv3 [24] and VGG-16 pre-trained models with SVM are utilized for viral, bacterial, and healthy image classification [25]. AI is categorized into two sub-groups as ML and DL. DL is an advanced form of classical ML [26]. DL approaches can be used to diagnose COVID-19, its methodologies named as the recurrent neural network (RNN) [27], conditional generative adversarial networks (CGAN) [28], autoencoder (AE) [29], and hybrid approaches such as RNN-CNN [30] and AE-CNN[31] have been used to detect COVID-19 [32, 33].

Extensive work has been carried out in the literature to detect COVID-19. This work has certain limitations in the classification of CT slices due to the limited data availability and the complex features analysis. Therefore, the main objective of this study is to construct a new framework to overcome the existing limitations. Hence an improved CGAN model is proposed for synthetic image creation that to improve classification accuracy. Next complex features analysis has been performed, that has not been implemented in the previous literature. The complicated patterns in the images have been learned using two proposed models trained from scratch. The first model is based on the convolutional neural network. It is constructed by the combination of the optimum structure of the layers with selected learning parameters. This enhances COVID-19 images classification accuracy. The second model is based on the quantum neural network. It has been constructed on a 4-qubit quantum circuit. We select the number of layers with optimum learning parameters to provide significant improvement in the learning of the complex patterns.

The following steps are the primary contribution of the proposed models:

  1. 1.

    A modified-CGAN model is designed with selected learning parameters for synthetic CT image generation/creation. The synthetic generated images are similar to the real CT images. This is useful for model training/testing that directly impacts the system accuracy.

  2. 2.

    The second main contribution of this research is to propose two models trained from scratch to analyze COVID-19 CT images such as CML and QNN. The proposed models use selected hyperparameters and layers with different activation units for COVID-19 classification.

The article organization is stated as follows: “Related Works” covers similar work, “Proposed Architectures” outlines the architectures suggested, “Results and Discussion” addresses the experimental effects, and the conclusion is found in “Conclusion.”

Related Works

The worldwide pandemic is caused by COVID-19 virus [34]. The transfer learning models are widely used for classification such as squeeze Net, mobileNetv2, VGG-19, VGG-16, ResNet-18, 50, 101, and Xception [35,36,37,38,39,40]. The DarkCovidNet model was developed to diagnose COVID-19 [41].

Quantum computing (QC) provides a more comprehensive framework for DL when compared to the classical computing (CC). QC improves the optimization of the underlying objective function. It reduces the training time of deep learning [42,43,44]. The convolutional neural network (CNN) is a classical machine learning model suitable to process the images. The CNN model is based on the idea of the convolutional layers applied to a local convolutional instead of processing the full original data with global function. This idea is further extended in the context of variational quantum circuits. The major difference when compared to classical convolution is that a quantum circuit might produce highly complex kernels whose computation could be classically intractable [45].

In recent years, deep learning is gaining a huge success in medical imaging. Several machine learning approaches are used to predict different health issues from the radiological images. Several ML applications can be used to produce optimal outcomes, but still needs human interference to aid the ML decisions [46]. Machine learning is a pervasive approach in many fields of engineering and sciences. Due to the restricted architecture of classic computers, there is a need to move to quantum computing to develop QML. The purpose of this study is to find more efficient algorithms to manipulate and process visual information in real-time at a very high speed [43, 47].

Previously several classical machine learning approaches are used for COVID-19 classification, but still have limitations. Prominent feature extraction is a challenging task. In this research, CML and QNN models are designed to resolve this issue.

Proposed Architectures

A new paradigm is suggested in this study, which comprises of two stages. In stage I, synthetic data is generated by applying a modified CGAN [48] architecture, where generator and discriminator network are trained by the optimal hyperparameters and are supplied to the two proposed architectures, such as CML and QNN [49], as illustrated in Fig. 1

Fig. 1
figure 1

Proposed architecture

Conditional Generative Adversarial Network

CGAN is a primary deep network that generates synthetic data having real imaging characteristics. A generative adversarial network (GAN) is constructed by the combination of generator and discriminator. The generator created CT synthetic images that are similar to the input CT images. Similarly, the second network is a discriminator that is used to take data in the form of batches comprising of observations to perform classification. The optimum generator performance is achieved to maximize the discriminator loss, and the optimum discriminator performance is increased to minimize the discriminator loss. The generator creates synthetic data and tricks the discriminator. The discriminator is trained to classify the data into corresponding classes such as real and synthetic images as shown in Fig. 2.

Fig. 2
figure 2

Conditional adversarial network for synthetic data generation

Generative Network

In this network, the projection and reshape layer is utilized to convert the input data into 1-by-1-by-100 arrays of the noise to the 7-by-7-by-128 arrays. Moreover, upsampling is performed with ReLU and batch normalization. The transposed convolution layers are applied with a \(5\times 5\) filter size. Stride 2 is used to crop the output on every edge. At the end-stage, tanh followed through a fully connected layer to reshape the output across the selected size.

Discriminative Network

The discriminator network takes images of dimension \(64\times 64\times 3\). The scalar prediction scores are returned by the series of convolutional, LeakyReLU, batch-normalization, and dropout layers. The parameters are selected for model training as mentioned in Table 1.

Table 1 Hyperparameters of CGAN

The layered architecture of CGAN with the activation units is depicted in Table 2.

Table 2 CGAN model with activations units

Proposed Classification Architectures

The synthetic images are supplied to the CML and QNN models for COVID-19 classification.

Classical Machine Learning

The CML model is proposed for classification which comprises three kinds of layers such as 01 convolutional, 01 flatten, and 02 dense layers as presented in Fig. 3.

Fig. 3
figure 3

Proposed CML model

The convolutional layers are primary building blocks in CNN, which maps the input images size of \(128\times 128\times 3\) with \(3\times 3\) kernel size and output in the form of activation which is mathematically explained as follows:

$$\text{G}\left[\mathrm{m, n}\right]=\left(\text{f} * \rm{h}\right)\left[\text{m n}\right]={\sum\nolimits_\text{j}}\sum\nolimits_\text{k} \rm{h}\left[\text{j, k}\right]\rm{f}\left[\rm{m}-\text{j, n}-\rm{k}\right]$$
(1)

where f denotes input images, h represents kernel size, and m, n symbolizes the row and column, respectively. The flatten layer is applied to collapsed spatial input dimensions into channel dimension \(\mathrm{height}\times \mathrm{width}\times \mathrm{channel}\). The dense layer is the layer of a regular neuron of the neural network, in which neurons receive input from all neurons from the preceding layers and connected densely as mentioned in Eq. (2).

$$\rm{Output}=\text{activation}(\rm{dot}\left(\text{input, kernel}\right)+\rm{bias}$$
(2)

The ReLU and softmax activation functions are utilized with the number of neurons such as 13 and 02, respectively. The model is trained on the hyperparameters that are selected after the comprehensive experiment as shown in Table 3.

Table 3 Training hyperparameters of the CML model

Quanvolutional Neural Network

A new QNN contains three kinds of layers, such as 4-Qubit-quantum layers, 03-dense layers with specified activation units, and drop-out layers. The quantum layer is added to replace the convolutional layer. The 4-bit quantum is used to generate the 20 \(\times\) 20-dimension quantum images. The quantum generated images are learned in a pipeline; then, a dense layer by ReLU and softmax with different activation units are applied. The model learning parameters are the same as the CML model (see Table 3) for the fair comparison among these two architectures such as CML and QNN.

Quantum Convolution

In the proposed quantum machine learning model, input images are divided into \(2\times 2\) square regions and embedded into the quantum circuit. The quantum images are generated through parametrized rotations with initialized the qubits in the ground state. In this process, the unitary might be created through the quantum variational circuit. Finally, the quantum system is computed by finding a classical list of expectation values. These values are mapped into the variant channel of the output (single-pixel). The process is repeated into variant regions; one might scan the full image and create output with a multi-channel image. Quantum convolutional might be followed through classical or quantum layers. The penny lane qubit device [50, 51] is initialized to simulate a 4 qubits system. The related q-node denotes quantum circuit comprising of rotations \({R}_{y}\) embedded local layer (scaled angle by π factor) and n random circuit layers. In the final computational measurement, 4 expectation values are estimated. In a convolution process, the input images are divided into \(2\times 2\) square pixels and each square is processed through a quantum circuit. Finally, the 4 expectation values are mapped into 04 channels of output (single-pixel). The proposed quantum model is presented in Fig. 4.

Fig. 4
figure 4

Quantum image generation

Quanvolutional Neural Networks

The quantum generated images are transferred to QNN, where 03 dense layers are used by 60, 500 neurons with ReLU activation and 02 neurons with softmax for features mapping. The 0.5 drop-outs are utilized. The proposed QNN building blocks are presented in Fig. 5.

Fig. 5
figure 5

Proposed QNN model

Results and Discussion

The proposed method is evaluated on two benchmark datasets, in which the UCSD-AI4H/COVID-CT dataset is publicly available that contains 812 COVID-19/non-COVID-19 images of 216 patients [52, 53]. The second dataset is collected from POF Hospital Pakistan, which consists of 4127 healthy and 5421 COVID-19 affected CT images. Furthermore, synthetic images are also generated by employing a CGAN model. Table 4 provides a comprehensive overview of the datasets.

Table 4 Dataset descriptions

Table 4 shows the description of UCSD-AI4H/COVID-CT and private collected dataset from POF Hospital, where actual images of UCSD-AI4H/COVID-CT are 406 healthy and 406 COVID-19. A total of 812 synthetic images are generated using the CGAN model out of which 406 healthy and 406 COVID-19. A total of 1612 images (actual + synthetic) of UCSD-AI4H/COVID-CT dataset are utilized for model training and testing.

For the second dataset, a total of 9548 synthetic images are generated using the CGAN model out of 4127 healthy and 5421 COVID-19 cases. A total of 19,096 images (actual + synthetic) are utilized for model training and testing.

The total actual and synthetic images are supplied to the training and testing using 0.4 and 0.5 hold-out validation. In 0.4 cross-validations, 60% data utilized for training and 40% for testing. Data is divided randomly into two subsets of 0.5 cross-validation, one for training and the other for testing.

This study is implemented on COREI7 CPU, WINDOW-10- SSD,16 GB RAM, and 2070 NVIDIA GPU. Two experiments are performed for the proposed method evaluation. CGAN model performance is computed in the first experiment. Similarly, in the second experiment, classification is performed on synthetically generated images using the CGAN model. The classification results are analyzed using two models such as CML and QNN.

Experiment #1: Synthetic Image Generation Using CGAN

To assess the efficiency of the modified CGAN model, synthetic CT images are produced. The model is tuned to reduce generative loss while increasing prediction accuracy. The generative loss function is mathematically explained below.

The goal of the generator is to generate and supply data to the discriminator model as real images. The maximum image probability to the generator is considered real by reducing the negative log function.

Given discriminator output Y as.

\(\widehat{Y}=\sigma (Y)\) represent the input probability that belongs to the real class.

\(1-\widehat{Y}\) denotes input probability that belongs to the generated class.

The generator loss function is expressed mathematically as

$$The \; generator \; of \; the \; loss=-mean(log \; log \left({\widehat{Y}}_{Generated}\right)$$
(3)

\(loss generator=-mean(log({\widehat{Y}}_{Generated})\) where \({\widehat{Y}}_{Generated}\) define output discriminator that shows the probability of the generated synthetic images.

The discriminator’s goal is not tricked through a generator. The discriminator probability successfully increased the training images and minimized the negative log function. The discriminator loss function is expressed mathematically as

$$\begin{aligned}Discriminator \; of \; the \; loss=&-mean\left(log \; log \left({\widehat{Y}}_{Real}\right) \right) \\ &-mean\left(log \; log \left({\widehat{Y}}_{Generated}\right)\right)\end{aligned}$$

where \({\widehat{Y}}_{Real}\) shows the output of the discriminator probability for input real images.

The generated images with generator loss as well as discriminator prediction scores are shown in Fig. 6.

Fig. 6
figure 6

Generated images with generative loss and discriminator prediction scores: a UCSD-AI4H/COVID-CT dataset and b POF Hospital dataset

The quantitative analysis of the predicted discriminator’s scores and generative loss is shown in Table 5.

Table 5 Quantitative assessment of CGAN model on benchmark datasets

The synthetic generated images are presented in Fig. 7.

Fig. 7
figure 7

Generated synthetic CT images

Some synthetic generated images concerning the class labels as displayed in Fig. 8.

Fig. 8
figure 8

Synthetic images with corresponding class labels: a Non-COVID-19. b COVID-19

Experiment #2: Classification Using Classical Machine Learning and Quanvolutional Neural Network Model

In Experiment #2, classification results are computed using a variety of measures, i.e., accuracy (AC), precision (Pn), Recall (Rl), and F1-score (Fe) as depicted in Tables 6, 7, 8, 9, 10, 11, 12 and 13. In terms of confusion metrics seen in Fig. 9, the proposed solution output is plotted.

Table 6 Discrimination results using CML with 0.4 hold out cross-validation on Chinese dataset
Table 7 Classification results using CML with 0.5 hold out cross-validation on Chinese dataset
Table 8 Classification results using CML with 0.4 hold out cross-validation on POF Hospital dataset
Table 9 Classification outcomes using CML with 0.5 validation on POF Hospital dataset
Table 10 Classification results using QNN with 0.4 hold out cross-validation on Chinese dataset
Table 11 Classification results using QNN with 0.5 hold out cross-validation on Chinese dataset
Table 12 Classification results using QNN with 0.4 hold out cross-validation on POF Hospital dataset
Table 13 Classification results using QNN with 0.5 validation on POF Hospital dataset
Fig. 9
figure 9

Confusion matrix: a, b 0.5 hold-out validation and c, d 0.4 hold-out validation

Classification Results Based on Classical Machine Learning

Tables 6, 7, 8 and 9 display the classification effects of the CML model on the benchmark datasets using 0.4&0.5 cross-validation.

Results on Publically Available (Chinese Hospital Dataset)

The classification results on UCSD-AI4H/COVID-CT dataset are displayed in Tables 6 and 7. Table 6 shows the results using 0.4 cross-validations on UCSD-AI4H/COVID-CT dataset.

The classification results of the CML model on 0.5 cross-validations are depicted in Table 7.

Results on Private Collected (POF Hospital Dataset)

The computed outcomes on POF Hospital dataset are given in Tables 8 and 9. The classification results of the CML model are mentioned in Table 8 using 0.4 cross-validations on the POF Hospital dataset.

In the same experiment, classification results of the CML model are also computed on 0.5 cross-validations as given in Table 9.

Classification Results based on Quanvolutional Neural Network

The COVID-19 classification is performed using the QNN model as presented in Tables 10, 11, 12 and 13 using 0.4 and 0.5 cross-validations.

Results on Publically Available (Chinese Hospital Dataset)

The classification results using the QNN model on the UCSD-AI4H/COVID-CT dataset are mentioned in Tables 10 and 11. Table 10 present the classification results of the QNN model using 0.4 cross-validations.

The QNN model performance is also computed using 0.5 cross-validations on the UCSD-AI4H/COVID-CT dataset in Table 11.

Results on Private Collected (POF Hospital Dataset)

Tables 12 and 13 display the classification findings. The classification outcomes on POF Hospital dataset using 0.4 cross-validations are depicted in Table 12.

Table 13 displays the classification findings computed using 0.5 cross-validations.

Results Comparison of the Proposed Classical Machine Learning and Quanvolutional Neural Network

The performance of the proposed CML and QNN models are graphically shown in Fig. 10, where classification accuracy is presented with quantum (QNN-model) and without quantum (CML-model).

Fig. 10
figure 10

Classification results on CML and QNN model on 0.4 and 0.5 cross-validation: a, b Chinese dataset and on 0.4 and 0.5 cross-validation. c, d POF Hospital on 0.4 and 0.5 cross-validation

Figure 10 presents the classification results using CML and QNN models using 0.4 and 0.5 cross-validation on the benchmark datasets, where the red line and blue line show the results of quantum (QNN model) and without quantum layers (CML-model) respectively.

In this article, lung CT images are classified using two architectures such as CML and QNN. Experimental outcomes manifested that QNN performed better on both datasets as compared to the CML. The findings of the proposed approach are compared to the five most recent methodologies given in Table 14.

Table 14 Comparison of the outcomes

The existing methods utilized transfer learning models such as ResNet-50, VGG-16, VGG-19, Xception, Inception ResNet, Inceptionv3, NasNet large, DenseNet121, ResNet50v2, Inception, and DenseNet169 for classification. The existing method achieved a maximum of 0.87 Fe; however, the proposed QNN model achieved 0.96 Fe.

Conclusion

COVID-19 detection is a challenging task because of the limited data availability and complex images features. To handle this issue, a modified CGAN model is proposed for synthetic CT image generation. This provides accurate results of image classification due to a better model training/testing. Result classification depends on the extracted features. In this research, two models are proposed such as CML and QML. The CML model achieved maximum accuracy of 0.85 on the UCSD-AI4H/COVID-CT dataset and 0.95 on the POF Hospital dataset, while the QML model achieved maximum accuracy of 0.96 on the UCSD-AI4H/COVID-CT dataset and 1.00 on the POF Hospital dataset. Overall experimental results conclude that the QML model performed better as compared to the CML model, which proves that quantum machine learning provided superior performance. In the future, this study can be extended to classify the severity of the COVID-19 patients such as mild, moderate, and severe to increase the survival rate of the patients.