1 Introduction

Since December 2019, the Coronavirus has dispersed globally. The World Health Organization (WHO) declared a pandemic caused by COVID-19 on January 30, 2020. As of 6 May 2022, there had been 513,955,910 confirmed cases of COVID-19 reported to WHO, with 6,249,700 deaths. As of May 6, 2022, the vast majority of cases (153,611,428 Cases) occurred in the Europe followed by Americas (216,346,110) and Southeast Asia (57,921,120). On 6 May 2022, there were 43,094,938 confirmed cases of COVID-19 in India, with 524,002 deaths, according to WHO. The most noticeable COVID-19 symptoms are fever and cough. The COVID-19 disease first sets in as difficulty in breathing, lack of oxygen and then it turns into acute lung infection. After entering the human respiratory system, severely affects the patient’s lung tissue, exacerbating conditions similar to and more drastic than the renowned ’Pneumonia’. The lungs gets engorged with fluid, inflamed, and cultivate patches.’ The patient must be kept in isolation and with adequate protection so that healthy people are not affected [1, 2]. Considering that the clinical manifestations are difficult to discern and that test kits are limited, researchers must surely find other methods of diagnosing it. Since a lot of effort has been made to make an appropriate COVID-19 treatment, the only effective way of protection is social distancing and lockdown of various cities around the country.

The lockdown, on the other hand, has a negative psychological impact on people’s health and intellects, as well as a negative impact on the country’s GDP. The number of people affected by COVID-19 is growing at an alarming rate all over the world. The massive affected countries, such as the United States, Italy, and Spain, have already surpassed China and will have a cataclysmic impact on the global economy. "This virus is as economically contagious as it is medically contagious," said Richard Baldwin, a Professor of International Economics at the Graduate Institute in Geneva. As a result, it is essential to establish a health clinic system based on Artificial Intelligence (AI) that is capable of detecting cases quickly and accurately in order to prevent this natural pandemic.

The application and employment of machine learning and deep learning in health care has been prevalent in recent times, and it has been seen to achieve high-level interpretation from multidimensional data [3]. For detection, classification and diagnosis purpose various machine learning algorithms such as support vector machines [4, 5], Random forest [6, 7], Support vector machines [8], Regression [3], AdaBoost [9], Long short term memory (LSTM) [10, 11], and Deep neural networks [12, 13] including deep convolutional neural networks and reinforcement learning are used. Deep Learning techniques have become increasingly popular in recent years, entirely improving the perspectives and outcomes of many fields of research. Image data sets such as retina images, chest X-rays, and brain Magnetic Resonance Imaging (MRI), in particular, provide favorable performance with greater accuracy when using deep learning techniques in the medical sector [14,15,16]. As we all know, X-ray machines are used in hospitals to scan diverse human organs at a low cost and in a timely manner. Typically, expert radiographers analyses numerous X-ray images manually. As a data analyst, those captured images if trained with the deep learning, we will be able to greatly assist health-care practitioners in detecting COVID-19 patients. This will benefit developing countries where X-ray facilities are available [17].

In addition to this benefit, we aspire to build a deep neural network called ’DeepCOVNet’ that can analyse X-ray images of the lungs and determine whether or not the individual is infected with the virus. Convolutional Neural Networks (CNN) have proven to be extremely efficacious in machine vision and biomedical imaging tasks CNN’s results have demonstrated its efficacy in mapping visual information to a concise and anticipated output. The main contribution of this research is the development of a CNN-based model for detection of COVID-19, which can train images of corona virus-infected lungs as well as healthy lungs. The proposed DeepCOVNet model can detect COVID-19 cases more quickly by detecting features of infected patients as foggy or darkened patches in X-ray images of the lungs. The use of ICT (Information and Communication Technology) in health care by several researchers provide us with some motivation [18,19,20]. The main motivation of this work is as stated below:

  1. 1.

    To propose artificial intelligence methods that are extremely necessary to overcome the health threats to own society.

  2. 2.

    To present a fast detection method based on X-ray image analysis that would benefit society.

  3. 3.

    To enhance and propose an AI based COVID-19 detection model for vast and diverse data analysis and prediction task.

The rest of the paper is organized as follows: Sect. 2 presents the related work, Sect. 3 presents the detailed methodology. Section 4 presents the experimental setup and results. Finally, Sect. 5 concludes the paper.

2 Related Work

It is clear that a large amount of work is yet to be dedicated to COVID-19 detection procedure from medical imaging techniques automatically. However, research work on earlier outbreaks produced by novel corona virus strains, such as severe acute respiratory syndrome (SARS), and was characterized by a similar lung disease [21], can be referred. Researchers have built deep neural network and convolutional neural network models to categorize Interstitial Lung Disease [22,23,24,25] using computerized tomography (CT) scans. Recently, several researchers have worked on COVID-19 classification with Convolutional Neural Network (CNN) on radiographic images. For example, Sethy et. al. give a comparative analysis of the performance of one of those of the most well-known convolutional structures [26]. They implemented a transfer learning-based strategy, and pre-trained models for feature extraction from images [10]. After this, a support vector machine is trained to the COVID-19 classification task. Similarly, a pre-trained convolutional neural network are employed for feature extraction, and the extricated features are then input to a classifier for COVID-19 detection [27]. Wang et al. introduce a different neural network design as the COVID-19 classification algorithms [28], while some other work utilized Resnet-based structure and the Inception v3 for COVID detection but makes system very complex [29, 30]. Kugunavar et. al. developed a simplified CNN system for binary classification of COVID-19 from CT images, with F1-score of 0.93, and achieved an accuracy of 93% [31]. Mukherjee et. al. developed a shallow CNN model for COVID-19 classification and the accuracy obtained was 96.92% [32]. Ozturk et al. trained DarkCovidNet with very few COVID-19 affected chest X-rays and achieved 87.02 % accuracy for COVID detection [13]. Subsequently, Altan and Karasu [33] have also implemented deep learning strategies and improved the accuracy with 95.24%. Other researchers have also developed CNN models for COVID-19 classification and these results would be compared with our work in the results section [34,35,36]. These researches has experimented with few data only with deep learning methodology but a deep learning model requires huge dataset to well train a model for classification task. Since the set of data utilized by these methodologies, the COVID-19 Chest X-ray [37] consists of less COVID-19 cases based solely on CXR and the other negative cases data are taken from other datasets. This however, raises an issue—any kind of typical bias, or a low level feature may influence the deep model. Such a model would fail to perform in its actual high level classification task, of detecting COVID-19 related features. At the same time, Deep learning has shown promising results for medical imaging in various perspectives. It is absolutely essential to exercise caution when training the feature extraction technique on a task: if the activity is extremely specific or involves preconceptions, the deep learning strategy should be used with extreme caution. This paper presented a fused dataset to obtain large number of COVID data to ameliorate the training process and boost the results. This paper’s major research contributions can be summarized as follows:

  1. 1.

    Study the effect of refactoring of datasets from different sources to overcome hidden biases, on the classification accuracy of DeepCOVNet model.

  2. 2.

    Build a Deep neural network based DeepCOVNet model for classification of CXR images into three classes—COVID-19, Pneumonia and Normal.

  3. 3.

    Compare and train our proposed model on different datasets with different pretrained models for parameter tuning.

  4. 4.

    With the aim for making the model robust, we have collected data from different datasets and prepared our train, test and validation data.

3 Methodology

We now describe the standard workflow for the proposed deep learning based approach called DeepCOVNet, which comprises of data preprocessing followed by the classification model obtained from the CNN model. The datasets used in this research work are described first. The proposed workflow is depicted in Fig. 1.

Fig. 1
figure 1

Workflow of proposed methodology

3.1 Dataset Description

There are two combinations of datasets namely Dataset A and B used for the experimentation in current research work. The Dataset A is obtained from two sources. Chest X-Ray scans of COVID-19 afflicted patients are obtained from the GitHub repository [37]; and the Kaggle repository [38] has been used for X-rays of normal and pneumonia patients. The Dataset B is extracted from the Kaggle repository [39] which consists of COVID-19, normal and pneumonia infected CXR images, and also 6012 images for lung opacity. This information isn’t accurately aimed to assert any Deep Learning model’s diagnostic ability but to investigate several methods of efficiently identifying using computer vision techniques to detect Coronavirus infections. As Deep learning model perform well with large datasets, therefore Dataset B is generated from two different dataset repositories to increase the training sample so as to reduce over-fitting in the proposed model. A total of 3223 X-ray images from the chest are included in the Dataset A. This data set is separated into training set (2509), testing set (258) and validation set (456). For Dataset B total 15153 X-ray images are used. A brief description of Dataset A and Dataset B are given in Table 1.

Balancing the training data is very important since unbalanced data favor biases in the learning process. We have addressed this issue by refactoring of the datasets. Such balancing issue can be addressed in a number of ways: the most common and simple way to solve this issue is adding or removing data from the training-set. Removing data from a tiny dataset is not a viable approach; considering that the COVID datasets are built mainly of positive cases, one solution is to augment them with negative cases from publicly available datasets. However, this is a very delicate operation and needs to be done very carefully: if all the negative cases are made of non-pathological patients, the deep model will not necessarily learn COVID features. It may simply discriminate between healthy and unhealthy lung. Providing a good variety of conditions in the negative data is not an easy task. The choice of the images may turn to be critical and, just like in the pre-training phase, one can include unwanted biases: again, the model can end up classifying new images (that are positive to covid) exploiting discriminative biases present in different datasets. Testing with different data than those used at training time is also fundamental. Excluding from the test-set exams taken from patients already present in the training-set is important to correctly evaluate the performance and to exclude the deep model has not learned a “patient’s lung shape” feature. Of course, many other issues have to be taken into account at training time, like the use of a validation-set to tune the hyper-parameters, using a good regularization policy etc. but these very general issues have been exhaustively discussed in many other works. 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.

Table 1 Dataset Description used in this work
Fig. 2
figure 2

Abstract of implemented VGG16 architecture

Fig. 3
figure 3

Abstract of implemented InceptionResNet architecture

Fig. 4
figure 4

Abstract of implemented XceptionNet architecture

Fig. 5
figure 5

DeepCOVNet architecture for COVID-19 detection from chest X-rays images

3.2 Convolutional Neural Network Based Deep Models

A convolutional neural network model is trained after the data has been pre-processed. The following decisions have been made in this regard: The feature extractor, i.e. the CNN’s convolutional layers, will be pre-trained. Such concept has been shown to be popular in clinical imaging, particularly when the availability of data is limited, as in our categorization problem. Pretraining the feature extractor, on a higher dimensionality dataset with attributes, will clearly help us to utilize deeper models, potentially allowing us to access richer image features. On COVID-19 data, the pretrained model will be fine-tuned. Fine tuning of the pre trained model is very essential for improved performance, because a large model may easily overfit training data. Four distinct models were implemented for analytical purposes, and their accomplishment was compared to evaluate the reliability of proposed model. The implemented architecture of these deep models are given in Figs. 2, 3 and 4 for VGG16, InceptionResNet and XceptionNet respectively.

VGGNet 16: The VGG16 framework is the most elementary convolutional structure announced by the University of Oxford. The labeled training datasets are routed through a stack of convolutional layers throughout this infrastructure. VGG16’s architectural style consists of 13 convolutions and 3 fully—connected layers. VGG has fairly small (3*3) filters that replace the preceding models’ 11 and 5 dimensioned filtration. Pooling layer is in charge of density compression followed by a softmax classifier that is accompanied by two fully connected layers with 4,096 nodes each and another fully - connected layers with three output classes [40].

InceptionResnet: A composite module was presented depending on the achievement of the ResNet performance. Each set to starting block is followed by a filter expansion, which is an 11 convolution without any activation function. This is added to enhance the dimensionality of the filtration system and supplement the input description towards another layer. The pooling operation inside the starting blocks replaced residual interactions. Another minor but significant distinction between both the residual and non-residual phase of the design is that InceptionResnet were using batch normalization on pinnacle of the conventional layers and not above the computation. The use of residual connections tries to avoid the performance degradation while also shortening training time [41].

XCeption net: It is a variant of the InceptionNet. Inception Net V3 is a CNN-based classification network. It has 48 layers and employs inception components, which include a cascaded layer with \(1\times 1\),\(3\times 3\), and \(5\times 5\) filter size. By doing so, we can lower the quantity of parameters while increasing learning rate. It is also known as the GoogLeNet layout. The inception functionalities are replaced with depth—wise separable convolution operation in the XceptionNet model. The point—wise convolutions are followed by the depth—wise separable convolutions in this framework. In addition, there is no ReLu nonlinearity in XceptionNet has been used. Its parametric size is comparable to that of the InceptionNet, but it performs comparatively better. [31, 42].

Loss Function: Categorical cross-entropy was used as the loss function. To prepare our model, we implemented the categorical cross-entropy loss. This is employed to optimize the hyper-parameters in our model. With each epoch, we intend to reduce the loss function. For training our conceptual framework, we used the Adam optimizer with a learning rate of 0.001.

3.3 Architecture of DeepCOVNet for COVID-19 Detection from Chest X-Rays Images

Since the objective is to classify COVID-19 infected chest X-Rays images, a modified version of CNN model called DeepCOVNet has been build for COVID-19 detection from chest X-Rays and classify it from normal and pneumonia chest X-Rays. The images of the chest X-rays are fed into the DeepCOVNet model as an input vector. The DeepCOVNet in this paper is made up of three Conv2D layers, each followed by a Maxpool2D layer, a 25% dropout layer, and two Fully connected (FC) layers. To transform the prediction between 0.01 and 1, all three layers have used the non-linear activation function ReLU (Rectified Linear Units). The maxpooling layer is used for down sampling the datasets to reduce redundant and irrelevant data from images. The dropout layer is applied to reduce overfitting problem arising due to imbalance in collected datasets. The tabular architecture with different layer wise operations and its input - output shape and other parameter’s size of a DeepCOVNet is given in Table 2. Figure 5 shows the architecture of proposed DeepCOVNet for COVID-19 detection. Here, the proposed algorithm of DeepCOVNet model has been elaborated significantly:

  1. 1.

    Preprocessing of images: Pre-processing used (Keras data generator has been utilized for this purpose):

    • rescale = 1./255,

    • zoom range = 0.2,

    • shear range = 0.2,

    • horizontal flip = True.

  2. 2.

    The first layer of CNN model takes the preprocessed 2D Xray image of size 224\(\times\)224\(\times\)3 and applies 32 2D filter with kernel size 3\(\times\)3 followed by a 2D MaxPooling layer with pool size 2\(\times\)2 with stride rate of 2 and a 25% dropout layer and outputs 111\(\times\)111\(\times\)32 feature map.

  3. 3.

    Then these feature maps are fed to the second Conv2D layer with 64 filter with kernel size 3 × 3 followed by a 2D MaxPooling layer with pool size 2 × 2 with stride rate of 2 and a 25% dropout layer and outputs 54 × 54 × 64 feature map.

  4. 4.

    The third layer consist of a MaxPooling layer with size 2 × 2 and stride rate 1 which keeps the same output size as previous feature size after the last Conv2D layer with filter size 128, 3 × 3 kernel size and output 52 × 52 × 128 convolved features of X-Rays images. After that Flatten layer is used to compress the n dimensional feature vector into 1D vector.

  5. 5.

    Finally, a Fully-connected layer with 64 dense size and ReLU activation function followed by a dropout of 25% has been applied to reduce over fitting problem and another fully connected layer with dense size 3 and SoftMax activation function are taken to classify the 3 types of Chest’s X-Ray images belongs to Normal, COVID-19 and Pneumonia infected patients.

Table 2 Architecture of Proposed DeepCOVNet model for COVID-19 detection

4 Experimental Setup and Results

4.1 Parameter Optimization of Proposed Deep Learning-Based DeepCOVNet Classification Model

To begin with, different designs with different parameters have been evaluated for Proposed Deep learning-based DeepCOVNet model, utilizing the above referenced datasets. As per the dataset description two dataset has been used i.e., Dataset A and Dataset B has been used for the classification of COVID-19, normal and pneumonia infected patient’s Chest X-ray images. As clarified in the above sections, the chest X-ray images of infected patients are initially preprocessed, which then serve as an input data for the Deep neural network-based techniques i.e., VGG16, InceptionResNet, XceptionNet and DeepCOVNet model. Additionally, these methods were trained in mini batches of size 32 for both datasets with image size 224\(\times\)224\(\times\)3. The VGG16, InceptionResNet and DeepCOVNet model used ADAM optimizer with learning rate 0.001. The RMSprop optimizer has been used for XceptionNet with \({1e}^{-6}\) learning rate. The categorical-crossentropy loss function has been implemented as the current experiment carried out a multiclassification problem with three classes i.e., COVID-19, Normal and Pneumonia. The experiment is done for 100 and 200 epochs for all CNN variants and DeepCOVNet model.

4.2 Classification Accuracy and Comparison with the Other Implemented CNN Variants and DeepCOVNet Model

The overall accuracy and error rate along with other evaluation parameters such as precision, recall and F1 score for all implemented models on both datasets is provided in Table 2. The DeepCOVNet model achieved 94.74% and 96.77% classification accuracy for Dataset A and 87.50% and 90.25% classification accuracy for Dataset B, on 100 and 200 epochs respectively which outperforms the other implemented CNN variants. From Table 3 it can be further seen that for Dataset A the XceptionNet performs second best at 93.8% accuracy for 100 epochs, while the InceptionResNet performs the second best at 94.21% for 200 epochs. For Dataset B, XceptionNet performs second best at 85.38% and 87.97% for 100 and 200 epochs.

On comparing with VGGnet16, the improvement of our DeepCOVNet model for Dataset A is 4% and 5.8% for 100 and 200 epochs respectively. For Dataset B these improvements are 5.7% and 15% for 100 and 200 epochs respectively. Comparison of our model with InceptionResNet shows that for Dataset A the improvements are 1.4% and 2.6% for 100 and 200 epochs respectively. For Dataset B these values are 4.7% and 5.6%. Finally, our model performance, when compared with XceptionNet is 1% and 3.2% better for Dataset A for 100 and 200 epochs, while for Dataset B the improvements are 2.5% and 3.1% for 100 and 200 epochs.

Figures 6a, b and 7a, b shows the loss and accuracy graph of training and testing of DeepCOVNet model on dataset A for 100 and 200 epochs respectively and Figs. 8a, b and 9a, b presents the DeepCOVNet model’s training and testing accuracy on Dataset B for 100 and 200 epochs. Figures 10, 11, 12 and 13 shows the comparison graph of all implemented variants of CNN and DeepCOVNet model on both datasets for 100 and 200 epochs. Figure 14a, b represents the comparison graph of classification accuracy of all implemented and DeepCOVNet techniques for COVID-19 detection on both datasets on 200 epochs. A comparative study with other pre-existing work on COVID-19 detection using X-ray images are represented in Table 4. It can be observed from the presented comparative study that our proposed 3 layer DeepCOVNet outperforms with other pre-existing studies for 3 class i.e. COVID-19/Normal/Pneumonia classification task. The proposed methodology achieved 96.77% accuracy which seems the highest with respect to other results for multiclass classification problem with the higher data size.

Fig. 6
figure 6

DeepCOVNet model accuracy and loss graph of Dataset A on 100 epochs

Fig. 7
figure 7

DeepCOVNet model accuracy and loss graph of Dataset A on 200 epochs

Fig. 8
figure 8

DeepCOVNet model accuracy and loss graph of Dataset B on 100 epochs

Fig. 9
figure 9

DeepCOVNet model accuracy and loss graph of Dataset B on 200 epochs

Fig. 10
figure 10

Comparative accuracy graph of Dataset A on 100 epochs

Fig. 11
figure 11

Comparative accuracy graph of Dataset B on 100 epochs

Fig. 12
figure 12

Comparative accuracy graph of Dataset A on 200 epochs

Fig. 13
figure 13

Comparative accuracy graph of Dataset B on 200 epochs

Fig. 14
figure 14

A comparative analysis of all implemented and the DeepCOVNet model’s accuracy graph

Table 3 Classification accuracy,error rate, precision, recall and F1 score for all implemented models on both datasets
Table 4 Comparison of DeepCOVNet based COVID-19 detection system with other existing work

5 Conclusion

Chest X rays can reveal a few distinguishing features in the lungs of COVID-19 patients. To keep the health care system from collapsing, a technology that can assist individuals diagnose diseases utilizing a low-cost, quick approach is required. In this respect, the literature suggests that using data mining algorithms to classify pneumonia disease in chest X-rays may aid diagnosis. The usefulness of deep learning approaches for identifying COVID-19 instances using CXR images is demonstrated in this paper. The current work provided an analysis of different researches that used CNNs to proficiently help diagnose and monitor COVID-19 patients in this article. The Deep learning is aided and abetted the use of pre-trained deep models for completing the various tasks. The combination of the small datasets are taken to increase the dataset dimension and to train the models. The empirical work, which used a modified CNN framework with less number of layers and classify chest X-ray images into COVID-19, Normal and Pneumonia cases, yielded an accuracy of 96.77% and an F1-score of 0.96 on Dataset A and 90.25% accuracy and 0.89 F1 score for Dataset B. Furthermore, the training epoch value was kept low to avoid overfitting. The DeepCOVNet model achieved comparable accuracy among all pre-trained model with only 3 convolutional layer that reduces the complexity and overcome the overfitting in the model. Nonetheless, the study found that DeepCOVNet can make a significant contribution to improvement of COVID-19 detection.