1 Introduction

Covid-19 is a severe disease issue where a large number of people lose their lives every day. This disease affects not only a single country, and even the whole world suffered because of this virus disease. In the past decade, several kinds of viruses (like SARS [1], MERS, Flu, etc.) [2, 3] came into the picture, but they stand for only a few days or few months [4]. Many scientists are working on these kinds of viruses, and few of them are diagnosed due to the availability of vaccines prepared by them (i.e., Scientists or researchers). In the present time, the whole world is affected by Covid-19 disease [5], and the most important thing is no single country scientists can prepare a vaccine for the same.

Meanwhile, many more predictions came into a picture such as plasma therapy, X-ray images [6, 7], and many more, but the exact solution of this deathly disease is not found. Every day, people lose their life due to covid-19 [8], and the diagnostic cost of this disease is very high in the context of a country, state, and patients [9]. In March 2020, X-ray images of healthy people and Covid-19 infected peoples [10] were available online in different repositories such as Github, Kaggle for analysis. Covid-19 is an epidemic disease that threatens humans at a global level and turned into a pandemic. To diagnose covid-19 infected patients with healthy patients is a critical task. The dialysis of Covid-19 infected patients needs more precaution and must be cured under very strict procedures to reduce the risk of patients unaffected with covid-19 [11].

The novel coronavirus disease came first as a throat infection, and suddenly people faced difficulty in breathing. The covid-19 illness is a hidden enemy where no one is capable of fighting. Infected patients of Covid-19 [12] are required to be in isolation, do proper screening, and take adequate protection with prevention to protect healthy people. This infection is following a chain process [13] that transfers from one person to another after coming in contact with covid-19 infected persons. Hospital staff, nurses, doctors, and clinical facilities play an essential role in the diagnosis of this epidemic. Many more strategies have been applied to reduce the impact of Covid-19. Medical imaging [14] is also a method of analyzing and predicting the effects of covid-19 on the human body. In this, healthy people and Covid-19 infected patients can be analyzed in parallel with the help of CT (Computerised Tomography) images [15, 16] and chest X-ray images. For contributing to an analysis of Covid-19, we collected uploaded data of X-ray images of healthy and covid-19 infected patients from different sources and applied three different models (InceptionV3, Xception, and ResNeXt). The analysis of this collected data is done with the help of CNN, a machine learning tool. This work mainly focuses on the use of CNN models for classifying chest X-ray images for coronavirus infected patients. We have attempted to draw a parallel to the previous work in the field and look for potential models of the task, which can be assessed further to prove their usefulness in practical scenarios.

This paper, further classified in the different sections such as section 2, discussed various researchers’ views in analyzing the impact of the covid-19 disease on countries and humans. Dataset used and model formulation is discussed in section 3. Different matrices and algorithms used are also discussed in section 3. Further, the evaluation of results in terms of training and testing with confusion matrices for models used is discussed in section 4. Next, this work is concluded in section 5 with its future scope.

2 Related work

In [17], the authors proposed a framework model based on Capsule Networks to diagnose Covid-19 (i.e., COVID-CAAPS) disease with the help of X-ray images. In this proposed work, several convolution layers and capsules are used to overcome the problem of class-imbalance. In experimental analysis, they showed the satisfying performance of COVID-CAPS on a smaller number of trainable parameters. Authors mentioned about the considered trained model which is publicly available on Github [18] for open access. As a result, they concluded that the proposed model shows accuracy 95.7%, whereas sensitivity is shown as 90% and specificity as 95.80% while applying a smaller number of trainable parameters. In [19], the authors considered the first three cases of Covid-19 infected cases in France. Out of these three persons, two were diagnosed in Paris and one in Bordeaux. Before coming in contact with Covid-19 diseases, they were staying in Wuhan, China.

In [20], the author proposed a hybrid system based on artificial intelligence, which specially used machine learning and deep learning algorithms (i.e., Convolutional Neural Network (CNN) using softmax classifier). The proposed system is specially implemented for detecting Covid-19 cases using chest X-ray images. In [21], the authors have given a radiologic analysis of MERS (Middle East Respiratory Syndrome) on novel coronavirus. They considered the case of a 30 year old male patient who suffered from diarrhea, fever, and abdominal pain. The authors gave an analysis of the treatment of infected persons with chest X-rays [22].

Further, they applied this model on a collected dataset of chest X-ray and CT images and received improved results. Also, in [11], they discussed what type of protocols are required to follow by hospital staff to minimize the risk of healthy patients and what precaution is needed in taking care of covid-19 infected patients. In [23], the authors discussed the outbreak of etiology in Wuhan, China. They also raised a question about the exact cause of this epidemic. In this study, they evaluate the traveling (via commercial or air) impact on covid-19.

In [24], the authors applied the SVM technique to identify pneumothorax. They used a Local Binary Pattern (LBP) to mine the characteristics of lung images. In the proposed detection model, the authors used multi-scale texture segmentation by removing impurities of chest images for segmenting the regions of abnormal lungs. Further, this transformation was applied for a change of texture for finding multiple overlapping blocks. Finally, the authors used rid boundary (with Sobel Edge detection) for finding a whole region of disease with the abnormal part. In [25], the authors considered 21 covid-19 patients’ chest CT scans in Wuhan, China. The authors majorly focus on the demonstration of covid-19 disease on human’s lungs and their impacts. Next, in [26], the authors proposed a COVID-RENet model to extract the features (i.e., edge and region-based) with CNN for classification. In this work, authors obtain features by applying CNN, and later on, they used SVM to improve the performance of classification. They used 5-fold cross-validation on a collected dataset of Covid-19. This proposed approach is mainly applicable to a medical specialist for the early diagnosis of Covid-19 infected patients. In [27], the authors applied a deep learning model on the collected image dataset of chest CT to identify the impacts of Covid-19 from persons acquired pneumonia and lung disease.

Further, in [28], an author has given a study about the impact of covid-19 on kidney and failure of acute renal. In [29], they considered a dataset of 50 patients who suffered from Covid-19 disease and segregated into two categories of recovery groups (i.e., good and poor). The serological and viral shedding was explored dynamically. Then, the authors identified the risk factor of weak recovery and lung infections. As a result, they concluded that 58% of the patients had a fragile recovery.

In [30], authors have given a study about the total number of patients infected form Covid-19 and death cases all over the world. In [31], the authors recommended a deep based methodology (with vector gadget classifier) for the detection of patients infected from Covid-19 by using X-ray images. This method is beneficial to hospital doctors for early detecting the cases of covid-19 infected patients. They find 97.48% accuracy of the proposed model for lung classification with the help of different matrices parameters. In [32], the authors discussed how novel coronavirus is exposed as a novel pneumonia disease in China, city Wuhan. The primary purpose of this paper was to present a new framework of deep learning, i.e., COVIDX-Net, to help the clinical practitioner in automatically diagnose Covid-19 disease by using X-ray images.

Further, in [33], the authors discussed the different methodologies used for covid-19 disease detection and challenges faced. They also said that an automatic method for detecting the Covid-19 virus should be developing to prevent the spreading of the disease through contact. Then, they analyzed different chest X-rays for the detection of pneumonia and concluded that it is hard to predict that Covid-19 causes pneumonia or any other symptoms are responsible for this.

In [34], the authors discussed the chest radiography (CXR) for identification of lung abnormality. They show that the medical community will rely on CXR because of its full availability and reduced infection control. In [18], they used 123 front views of X-ray for the detection of Covid-19 diseases. Further, in [35], the authors discussed the role of AI tools in healthcare. They also talked about the challenges of implementing AI tools on less dataset of X-ray images (which is available publically). The authors considered a dataset of X-rays and CT images from several resources and applied deep learning and transfer learning algorithms to detect Covid-19 diseases. AlexNet pre-trained and modified CNN model has been used on a collected dataset. As a result, they showed that the pre-trained model gave 98% accuracy, and changed CNN shows 94.1% accuracy of the model. In [36], the authors extracted two subsets (16*16 and 32*32) patches to generate sub-datasets, which is derived from 150 CT images, and 3000 X-ray images have been labeled for Covid-19.

Further, fusion and ranking methods have been applied to enhance the performance of a proposed methodology. The authors used SVM to classify the processed data, and the CNN model was used to transfer learning. As a result, they showed that set 2 received good accuracy as compared to set 1.

In [37], the authors proposed a model that automatically detects the Covid-19 with the help of Chest X-ray images. The planned model is used to give accurate diagnostics on two different classification models (i.e., binary and multi-class). They applied the DarkNet model to classify the real-time object detection method. In [38], the authors discussed the use of thermoplasmonic in the detection of Covid-19 diseases. In [39], the authors consider the patients who confirmed with covid-19 pneumonia and were admitted to the hospital in China, Wuhan. They divide the patients of CT scan into different groups, and features of the image and its distribution were further analyzed and compared for detecting Covid-19 diseases. In [40], the authors proposed a KE Sieve Neural Network architecture, which helps in finding the analyses of Covid-19 by using Chest X-ray images. Their proposed model shows 98% accuracy of their model.

In [41], authors conducted a study of covid-19 to the persons who have been isloateed in BBH hospital ward located at Rawalpindi. In [42], the authors CNN based algorithm for analyzing pneumonia by using a chest X-ray dataset. They used two different models (i.e., VGG16 and InceptionV3) for transferring learning on CNN. They further applied SVM for finding better results. In [43], the authors talked about the implementation of a deep anomaly detection method for reliable screening of Covid-19 patients. They have collected 100 chest X-ray images where 70 persons were confirmed positive with Covid-19. Finally, in [44], they discussed the impact of Covid-19 on humans. They considered the dataset of 101 cases of Covid-19 infected pneumonia. The primary goal of this study was to compare the clinical condition of Covid-19 pneumonia with CT images. After analyzing all the views and proposed work given by different researchers, Covid-19 is a virus disease that not only has an impact on humans as well as on a country. They discussed different methodologies used for detecting Covid-19 cases early. We implemented three models (i.e., Inception V3, XCeption, and ResNeXt) on a collected dataset of chest X-ray images. Section 3 and 4 give a complete description of these models, and their comparison is shown in section 4.

3 Materials and methods

The dataset used and the methodology used is explained in the subsequent sections.

3.1 Dataset

The dataset of this work has been collected from Kaggle repository [45], which contains Chest X-Ray scans of Covid-19 affected, normal and pneumonia. This collected dataset is not meant to claim the diagnostic ability of any Deep Learning model but to research about various possible ways of efficiently detecting Coronavirus infections using computer vision techniques. The collected dataset consists of 6432 total chest X-ray images. This data set is further divided into training (i.e., 5467) and validation (i.e., 965) set of normal, covid, and pneumonia. In the training set, 1345 is normal, 490 are covid, and 3632 is pneumonia. In the validation phase, 238 samples of a normal case, 86 covid, and 641 of pneumonia were considered for this analysis. At the time of the drafting of this paper, we had 576 PA (Posteroanterior) View scans of Covid-19 affected patients. The scans were scaled down 128 × 128 to aid the fast training of our model. The PA view scans were deemed to be consistent with our covid dataset. Table 1 displays the data distribution for training and testing the data.

Table 1 Dataset Distribution

3.2 Model formulation

The data obtained from the Kaggle repository [45] was cleaned as needed. To implement a deep learning method [46] requires a large amount of dataset to receive reliable results. But it could be possible that every problem does not have enough data, especially in medical-related issues. Sometimes collecting medical-related data may be time consuming and expensive. To solve these kinds of difficulties, augmentation can be applied. Augmentation can overcome the problem of over-fitting and enhance the accuracy of the proposed model.

Further, augmentation is applied in this collected dataset to prevent over-fitting. The augmentations included rotation, zoom, and sharing of images. The data was then shuffled to generalize the model and reduce over-fitting. After this, the prepared dataset was used to train the proposed model. For better analysis, three different models have been implemented, and then their performance was compared to calculate the accuracy. In the given models, we implemented LeakyReLU activation instead of the originally used relu activation function, which makes it as a novel method. This process helps to speed up the training and also avoids the problem of dead neurons (i.e., the relu neurons become inactive due to zero slope). Figure 1 shows the proposed model for chest x-ray image analysis.

Fig. 1
figure 1

Proposed model for chest X-ray dataset evaluation

3.2.1 Inception net V3

Inception Net V3 is a CNN based network for classification. It is 48 layers deep and uses inception modules, which comprises of a concatenated layer with 1 × 1 3 × 3 and 5 × 5 convolutions. Doing this, we can decrease the number of parameters and increase the training speed. It is also referred to as GoogLeNet architecture [47]. Figure 2 describes the abstract form of the Inception Net V3 Model.

Fig. 2
figure 2

Abstract form of Inception Net V3 Model

3.2.2 XCeption net

It is a modification of the inception net. In this model, the inception modules are replaced with depthwise separable convolutions. Its parameter size is similar to the Inception net, but it performs slightly better as compared to the inception net [48]. The abstracted form of the Xception model is shown in Fig. 3.

Fig. 3
figure 3

Abstracted form of Xception model

3.2.3 ResNeXt

RESNeXt is an extension architecture of the deep residual network. In this model, the standard remaining blocks are replaced with one that leverages a split - transform - merge strategy used in the Inception models [49]. The ResNext architecture model is shown in Fig. 4.

Fig. 4
figure 4

ResNeXt model architecture

3.2.4 Loss function used: Categorical cross-entropy

We have used the categorical cross-entropy loss to train our model. It is used to optimize the value of parameters used in our model. We intend to decrease the loss function with successive epochs. We have used adam optimizer with a learning rate = 0.001 for training our model.

$$ L\left(Y,\hat{Y}\right)=-\left(\sum Y\ast \mathit{\log}\ \left(\hat{Y}\right)+\left(1-Y\right)\ast loglog\ \left(1-\hat{Y}\right)\ \right) $$

Where, Y = true label, \( \hat{Y}= Predicted\ Labels, and\ L\left(Y,\hat{Y}\right)\ is\ loss\ function. \)

3.3 Proposed algorithm

The approach used for implementing the proposed model is discussed below

  1. Step 1:

    Pre-process image i.e. image = X

Pre-processing used (We have utilized Keras data generator for this purpose:

  1. i.)

    Reshape image (X) to (128, 128, 3)

  2. ii.)

    Random rotation range = 10°

  3. iii.)

    Horizontal Flip = True

  4. iv.)

    Zoom Range = 0.4

Note: shape = (128, 128, 3) for fast processing

shape = (256,256,3) for better performance

  1. Step 2:

    Apply the image to an input of the pre-trained model:

  1. Step 3:

    Fetch the output of the last convolution layer of the given model.

  1. Step 4:

    Flatten dimensions with reducing n dimensions to n-1.

  1. Step 5:

    Apply a dense layer

units = 256 for XCeption Net and Inception Net

units = 128 for ResNeXt

$$ Z=W\ast A+b $$

where, W = Weights and b = bias

  1. Step 6:

    Apply Activation

$$ A= LeakyReLU(Z) $$
  1. Step 7:

    Apply Dense Layer for inference

$$ Z=W\ast A+b $$
  1. Step 8:

    Apply softmax for classification

$$ softmax\left({Z}_i\right)=\frac{e^{z_i}}{\sum_{j=1}^k{e}^{z_j}} $$

# LeakyReLU (Z) = max (0.01,Z)

3.4 Matrices used for result evaluation

The proposed model has been evaluated with the help of different parameters such as precision, recall, F1 score [50], and its accuracy, sensitivity, and specificity [51], as shown in Eqs. (8) to (12).

$$ Precision=\frac{True\ Positive}{True\ Positive+ False\ Positive} $$
$$ Recall\ \left( or\ Sensitivity\right)=\frac{True\ Positive}{True\ Positive+ False\ Negative} $$
$$ F1\ Score=2\ast \frac{Precision\ast Recall}{Precision+ Recall} $$
$$ Accuracy=\frac{True\ positive+ True\ Negative}{True\ positive+ False\ Negative+ True\ Negative+ False\ Positive} $$
$$ Specificity=\frac{True\ Negative}{True\ Negative+ False\ Positive} $$

4 Experimental results and discussions

In result analysis, typical chest X-ray images have been compared with Covid-19 affected people. Inception Net V3, Xception Net, and ResNeXt are analyzed based on accuracy matrices. The results were then contrasted to determine the best model. Although the model accuracies are pretty high, we recommend validating the performance using future updates on the dataset. Due to the scarcity of data, the model is trained only on 1560 samples.

4.1 Xception net

It is a modification of the inception net. In this model, the inception modules are replaced with depthwise separable convolutions. Its parameter size is similar to the Inception net, but it performs slightly better as compared to the inception net.

Tables 2 and 3 depict the f1-score for training and testing set for XCeption Net Model.

Table 2 Training dataset
Table 3 Testing Data

Figure 5 discusses the result analysis of training and testing with the loss and accuracy of the Xception model. Fig. 6 shows the confusion matrix of training and testing of the Xception model.

Fig. 5
figure 5

(a) Training and Testing Loss of Xception Net with successive epochs. (b) Training and Testing Accuracy of Xception Net with successive epochs

Fig. 6
figure 6

(a): Confusion matrix of train data of Xception model. (b): Confusion matrix of test data of the Xception model

4.2 Inception net V3

It is a state of the art CNN network for classification. It is 48 layers deep and uses inception modules, which comprises a concatenated layer with 1 × 1 3 × 3 and 5 × 5 convulsions. Doing this, we can decrease the number of parameters and increase the training speed. It is also referred to as GoogLeNet architecture.

Tables 4 and 5 depict the f1-score on training and testing set for the Inception V3 model.

Table 4 Training Data
Table 5 Testing Data

Figures 7 a show the training loss for our Inception Net model as it reduces with the consecutive epochs, and Fig. 7b shows the model accuracy for our Inception Net model as it improves with the successive epochs.

Fig. 7
figure 7

(a): Training and Testing Loss of the Inception V3. (b) Training and Testing Accuracy of an Inception V3

Figure 8a and b shows the confusion matrix of training and testing data of Inception V3 model.

Fig. 8.
figure 8

(a) Confusion matrix of train data of Inception V3. (b): Confusion matrix of test data of Inception V3

4.3 ResNeXt

This architecture is an extension of the deep residual network. In this model, the standard remaining blocks are replaced with one that leverages a split - transform - merge strategy used in the Inception models.

Tables 6 and 7 show the f1-scores for the training and testing sets for ResNeXt Model

Table 6 Training Data
Table 7 Testing data

Figure 9a shows the model accuracy for the ResNeXt model as it improves with the successive epochs, and Fig. 9b shows the training loss for the ResNeXt model as it reduces with the successive epochs.

Fig. 9
figure 9

(a) Training and Testing Loss of ResNeXt model. (b) Training and Testing Accuracy of ResNeXt model

Figure 10a shows the confusion matrices obtained for the train and test set, respectively. Fig. 10b shows that the misclassified samples are negligible. The above Figs. 5, 7, and 8 show the training and testing performance as the model trains with successive epochs. We can see that our ResNeXt model is prone to over-fit, but it still gives optimal accuracy. Moreover, we can see that XCeption Net has the best performance among all the discussed models.

Fig. 10
figure 10

(a). Confusion matrix of train data of ResNeXt model. (b): Confusion matrix of test data of ResNeXt model

5 Conclusion and future scope

Covid-19 pandemic is a growing manifold daily. With the ever-increasing number of cases, bulk testing of cases swiftly may be required. In this work, we experimented with multiple CNN models in an attempt to classify the Covid-19 affected patients using their chest X-ray scans. Further, we concluded that out of these three models, the XCeption net has the best performance and is suited to be used. We have successfully classified covid-19 scans, and it depicts the possible scope of applying such techniques in the near future to automate diagnosis tasks. The high accuracy obtained may be a cause of concern since it may be a result of overfitting. This can be verified by testing it against new data that is made public shortly. In the future, the large dataset for chest X-rays can be considered to validate our proposed model on it. It is also advised to consult medical professionals for any practical use case of this project. We do not intend to develop a perfect detection mechanism but only research about possible economically feasible ways to combat this disease. Such methods may be pursued for further research to prove their real case implementation.