1 Introduction

Infectious diseases continue to be the leading cause of mortality worldwide. Infectious illnesses are caused due exposure to infectious causing agents such as protozoa, bacteria, fungi, viruses, and helminths [1]. Several infections that originated in rural areas have adapted to urban conditions, while others have originated or reappeared in urban areas. Due to the variety in the health of metropolitan residents, higher contact rates, and the mobility of individuals, large urban populations are at high risk for spreading the disease. In fact, infections can swiftly spread to other city regions which includes affluent neighborhoods and tourist destinations, even though the prone urban neighborhoods are often the first to be impacted [2].

In a globalized world, cities also serve as entry points for the global spread of infectious diseases. These challenges significantly affect public health, altering chronic and infectious diseases’ epidemiological and global consequences [3]. Microorganisms most commonly cause infectious diseases. They are significant because of the kind and quantity of harm their causal agents cause to organs and systems once they enter a host, as shown in Fig. 1. The immune system naturally combats and eliminates infectious germs and infectious diseases only occurs when the immune system fails to eliminate such infectious pathogens. Consequently, all infectious diseases manifest in a specific population, context, or environment at some point [4].

Fig. 1
figure 1

Virus/bacteria into the body [4]

When we comprehend the complexities of infectious diseases and the mechanisms for mitigating them, there are various methods to combat, prevent, and manage illness. Depending on the pathogenic cycle for a particular condition, infectious diseases can be prevented on multiple stages. In some situations, the infectious diseases can be combated using various procedures such as vaccination, medication, vector control strategy and that are already there in the medical sector [5] while as there are also other diseases where such control methods are ineffective, underdeveloped, or nonexistent. Researchers are working for developing the new tools which are necessary to eradicate such human issues. To develop such tools require the study of the pathogen’s life processes and interactions with the host, translational research to generate new tools, and clinical research to assess the safety and effectiveness of these new tools [6].

Quality of the data and facility provided to the patients has created new opportunities especially in medical sector. These discoveries have lead to a greater understanding to improve patient risk management plan, healthcare-related illnesses including the risk factor and the detection of intra- and inter-facility transmission of infectious diseases which enables more targeted preventive measures [7]. But sometimes it also showed some limitations such as the volume or the complexity of the data, lack of collection as well as storage capabilities of any medical record. Such data are typically underutilised and undervalued, but some new and improved data collection and storage technologies have been studied which has the potential to solve the analysis problem [8]. Thusly, it is crucial to establish efficient and effective measures to fight against the threat of infectious diseases by having the proper data to analyse and minimum time to detect as diagnose them.

In this era, Artificial Intelligence (AI) has become such a valuable and necessitate tool in the healthcare industry. A lot of times artificial intelligence has shown great miracles in the medical section to diagnose and interpret complex diseases. Researchers have been aided by artificial intelligence to comprehend the capabilities of virus, pathogenicity, and genome [9]. It also facilitates the researchers to predict the protein structure of virus and their chemical bonding to hasten the creation of new antiviral medications and vaccines.

Machine Learning (ML) and Deep Learning (DL) are the most effective weapons that can be used against the rapid spread of infectious diseases [10]. Researchers like Evalgelista et al. [11] used Convolutional Neural Networks to design a computer-aided technique based on intelligent pattern identification on chest X-rays. Their project employed nine distinct architectures and two ensembles to tackle this problem. The highest validated performance achieves an accuracy of 88.76%. The experimental data originates from publicly available medical databases and includes real-life examples of individuals of various ages and physical features. Ahsan et al. [12] investigated that for classifying medical images, whether convolutional neural networks are the viable alternative to decision tree-based systems. Their objective was to create a generalized model that handles all the complicated pre-processing procedures that a traditional decision tree would take. During experimentation, their model obtained the high accuracy of 80% without augmentation and 81.25% with augmentation. Similarly, Prasad et al. [13] used a convolutional neural network to distinguish parasitized from non-parasitized samples (CNN). Pre-trained and custom-built models were evaluated to determine which was superior. Standard preparation procedures were employed to extract different aspects of the data to enhance performance. This suggests that an AI is reliable and capable of detecting infectious illnesses to reduce the workload of physicians, doctors, and clinicians.

In this paper, the dataset of seven infectious diseases like covid-19, lung opacity, MERS, Pneumonia, SARS, Tuberculosis, and Viral Pneumonia, along with the normal lungs, have been taken and applied to various pre-trained models such as EfficientNetB0, EfficientNetB1, EfficientnetB2, EfficientNetB3, NASNetLarge, DenseNet169, ResNet152V2, and InceptionResNetV2. The models have been assessed based on several factors, including accuracy, loss, precision, F1 score, RMSE, and recall. When the model was applied to a testing dataset, the InceptionResNetV2 model generated the highest accuracy by 88%, loss by 0.399, and RMSE by 0.63. During the training phase, EfficientNetB0 calculated the best accuracy, loss, and RMSE values by 89.09, 0.29, and 0.54.

The following are the contributions made in this research paper:

  1. 1.

    The dataset has been initially taken from the eight classes which include seven infectious diseases and one normal lung image dataset.

  2. 2.

    Using exploratory data analysis, the images in the dataset have been graphically visualized to extract their color channels in the form of an RGB histogram.

  3. 3.

    Later, the original images are pre-processed by converting them into grayscale, followed by image augmentation and contrast enhancement techniques.

  4. 4.

    Using techniques such as contour features and Otsu thresholding, features have been extracted and are later split into training and testing sets.

  5. 5.

    Various deep learning-based models are trained using training and testing images to calculate the values for different parameters such as accuracy, loss, F1 score, recall, precision, and RMSE values, to determine the most effective model for detecting the class of infectious diseases.

1.1 Organization of the Paper

The research paper has been organized in which Sect. 1 has already defined as Introduction, where brief information about infectious diseases, their impact, and AI methods to tackle them have been mentioned. Section 2 defines the context to discuss the work done by researchers in the field of various infectious disease detection. Section 3 defines the dataset, procedures, techniques, and parameters which are being used to generate the results mentioned in Sect. 4. Finally, in Sect. 5, the entire paper has been summarized and concluded, along with a few future directions and challenges.

2 Background

The summarization, enhancements, challenges, classification, and potential impact of research papers produced in this field are evaluated in depth. In addition, research articles are categorized based on various characteristics, such as technology, employed methodologies, data sets, limitations, and findings. Table 1 lists the multiple papers evaluated for this study. Kamana et al. [14] examined the impact of climate on the comeback of malaria in mainland China. In comparison to other candidate models, the proposed LSTMSeq2Seq model reduced the mean RMSE of predictions by 19.05% points to 33.93% points, 18.4% points to 33.59% points, 17.6% points to 26.67% points, and 13.28% points to 21.34% points for P. falciparum, P. vivax, and other plasmodia, respectively. The LSTMSeq2Seq model showed the prediction performance by 87.3%.

Table 1 Analysis of previous researcher’s work

Furthermore, more complicated structures were developed and tested to find the most efficient model. The custom model’s accuracy is 97.50%. Cinar et al. [15] used Convolutional Neural Networks (CNN) to distinguish between healthy and parasitic malaria images. The original dataset is then passed through a medium and gauss filter. The DenseNet201 architecture has the most remarkable accuracy rate of 97.83% when identifying malaria data using gaussian filtered data. To classify the severity of Covid-19, Irmak et al. [16] proposed a novel CNN-based method. By taking chest x-ray images as an input, the researchers hypothesized that an automated CNN model could classify the four categories of COVID-19 patients, namely mild, moderate, severe, and critical, with an accuracy of 95.52%.

Leblic et al. [17] employed machine learning algorithms to anticipate a COVID-19 diagnosis utilizing a cross-testing technique. Lack of smell and taste were linked to elevated COVID-19 positive probability scores by 6.21 and 2.50, respectively. To predict a Covid-19 diagnosis, the ML algorithms achieved 80% accuracy, 82% sensitivity, and 78% specificity. Using cough detection during recorded conversations, Feng et al. [18] developed a technique for the automated diagnosis of COVID-19. The approach collects critical elements from the audio stream. It then classifies those using AI-based models such as SVM, KNN, and RNN, and when applied to the training and test sets separately, the highest accuracy obtained was 81.25% (AUC of 0.79).

To reliably diagnose TB from chest X-ray images, Rahman et al. [19] used imaging data augmentation and segmentation techniques, whereas the X-ray segmentation process using two different methods and X-ray classification techniques were all part of this work. For segmented lung pictures, DenseNet201’s accuracy, F1-score, sensitivity, precision, and specificity were 98.6%, 98.56%, 98.56%, 98.57%, and 98.54%, respectively.

Leo et al. [20] investigated the application of machine learning methods to simulate cholera outbreaks associated with seasonal weather oscillations while addressing the issue of data imbalance. This action was taken to identify a solution to these problems. The sensitivity, specificity, and overall accurateness of each of the seven models were also assessed to assess their overall performance. Based on the outcome of the model’s attributes, the XGBoost classifiers were chosen as the most appropriate choice for the research. In general, the findings increased knowledge of the crucial functions that machine learning offers in healthcare data analysis. Finally, Midani et al. [21] reported that gut microbiota-based ML algorithms and models based on known epidemiological and clinical risk indicators correctly guessed V. cholerae infection. To discriminate between sick individuals and those who were not, researchers looked at the gut microbiota of roughly 100 bacterial species. Furthermore, cholera susceptibility has been associated with low Bacteroidetes bacteria numbers.

As per Hossain et al. [22], the belief rule-based expert system (BRBES) could model uncertain knowledge and inference under uncertainty. Furthermore, BRBES findings were compared with the numerous data-driven machine-learning approaches. Verma [23] compared the outcomes of the forecasting model in terms of the trend shown and the error numbers. According to the findings, the neural network model has the slightest error and is our dataset’s most accurate forecast model. When compared, the root means a square error of neural net and box cox forecast accuracy is 6.749 and 27.278, respectively.

Torres et al. [24] used time-series forecasting methodologies and machine-learning technologies to predict chikungunya mortality trends. The data of chikungunya was collected from the year 2007 to 2016 which is mentioned in the National Health Centre. The researchers used Rolling-origin based cross-testing to determine the performance of such techniques. Multiple sets of predictive characteristics were examined by the Ashari et al. [25] where they determined the optimal set of 370 characteristics for effector prediction. By building three machine learning algorithms, they compared their findings to others and generated the best results. Their research focused on the most effective technique for using these ideal traits. Palma et al. [26] worked on a data of microbial VOCs (Volatile Organic Compounds) which is having pathogen discrimination potential. The researchers had used machine learning algorithm such as Support Vector Machine and tools to select the feature for training classifier [27]. The source data were published studies between 1977 and 2016 that reported VOCs generated by human microbial infections. A sample of 18 VOCs can predict the detection of 11 microbiological diseases with high accuracy (77%) and precision (62–100%). Furthermore, each of the 11 diseases has a unique collection of VOCs that may accurately predict the existence of that pathogen. Mohammadinia et al. [28,29,30,31,32] used Geographical Weighted Regression, Generalized Linear Description, support vector machine, and Artificial Neural Networks to describe and forecast the geographical distribution of leptospirosis. The classifier was trained using data from 2009 and 2010, then tested and evaluated on data from 2011. Likewise, Park et al. [33,34,35,36,37,38,39,40] used chest X-ray images for the detection of Mycobacterium Tuberculosis bacteria in it. The researchers collected data of 3314 patients who are infected with TB bacteria and those who are normal. Deep learning models such as EfficientNetB4 and ResNet50 were applied where it had been found that the ensemble model obtained the accuracy of 85%.

3 Material and Methods

This section discusses the various phases used to conduct the research, such as Sect. 3.1 providing information about the dataset. Section 3.2 presents the graphical visualization of images, Sect. 3.3 explains the techniques to pre-process the data, Sect. 3.4 describes the methods to extract the features, and Sect. 3.5 briefly explains the models used. In the end, Sect. 3.6 provide an overview of the parameters which are used for examining the performance of the model. The flow of all these phases is shown in Fig. 2.

Fig. 2
figure 2

Proposed system to classify infectious diseases

3.1 Dataset

The datasets for covid 19, lung opacity, MERS, pneumonia, tuberculosis, SARS, normal lung images, and viral pneumonia have been compiled from various sources. The images of lung opacity, viral pneumonia, covid 19, and normal lungs are taken from a database of covid-19 radiography. The database has images of 1341 normal and 1345 viral pneumonia chest X-ray (CXR). Later, 3616 COVID-19-positive cases, 10,192 Normal, 6012 Lung Opacity (Non-COVID lung infection), and 1345 Viral Pneumonia images and corresponding lung masks were added [41]. The pneumonia disease images are acquired from a database of chest x-ray images (Pneumonia), which is divided into three folders (train, test, and val) and contain subfolders for each image category (Pneumonia/Normal). There are 5863 JPEG X-Ray images and two types (Pneumonia/Normal) [42]. The tuberculosis image dataset has been used to train the tuberculosis-based images, which have been extracted from a sputum sample. The dataset contains 928 sputum images with bounding boxes of 3734 bacilli, and the XML file contains image bounding box details [43]. In total, 29,252 images from the aforementioned classes were used to train and test the model, with the image count per class listed in Table 2. The model is run on the Jupyter Notebook platform by importing several Python libraries such as pandas, NumPy, matplotlib, sklearn, Keras, TensorFlow, seaborn, and OpenCV.

Table 2 Number of images per infectious diseases class

3.2 Exploratory Data Analysis

Initially, the image is graphically represented in histograms to count and display the intensity distribution in RGB. Such visualization also aims to detect anomalies and study an image’s pattern. As shown in Fig. 3, the histogram of the original images is not equalized, indicating that the images either have missing information or have noisy signals. The histograms were created with the hist(). After extracting it, we flatten the color channel and its array and pass it to the hist (). The bins should be 256 for each pixel value (0 being completely black and 255 being completely white).

Fig. 3
figure 3figure 3

Histogram visualization of images ((i) covid 19, (ii) Lung opacity, (iii) MERS, (iv) Normal, (v) Pneumonia, (vi) SARS, (vii) Tuberculosis, (viii) Viral pneumonia)

3.3 Pre processing

After assaying the pixel intensities of the infectious disease images graphically, it is essential to pre-process to improve the quality so that we can analyze them more effectively. On the diseases image dataset, two image augmentation techniques have been used: a horizontal flip and a vertical flip, as shown in Figs. 4 and 5. Flipping an image (and its annotations) is a deceptively simple technique that can significantly improve model performance. The primary function of these techniques is to reverse the pixels row-wise or column-wise. To manipulate images horizontally, we used NumPy functions such as np. flipud() or np.fliplr(). Horizontal flip involves horizontally flipping both rows and columns. Vertical flip rotates both rows and columns vertically.

Fig. 4
figure 4

Horizontal flip of original images

Fig. 5
figure 5

Vertical flip of original images

Here, the original colored images are converted into grayscale. Many image processing algorithms require grayscale, 2D arrays because the color isn’t the defining feature of pictures, and computers can already extract enough information without it. From color-to-grayscale, function G takes the Rmxnx3 color image and converts it to Rmxn representation, where all image values are assumed to be between 0 and 1. Figure 6 shows the conversion of the original images of eight classes into their grayscale format. The main advantage of converting the RGB into grayscale is simplifying the algorithm and reducing computational requirements.

Fig. 6
figure 6

Grayscale conversion of RGB images (a covid 19, b Lung opacity, c MERS, d Normal, e Pneumonia, f SARS, g Tuberculosis, h Viral pneumonia)

After converting the RGB images into grayscale, their contrast have been enhanced (Fig. 7) so that the darkness and brightness of the objects can be adjusted to improve the image’s visibility. It has been done through a gray-level transform where the gray levels in the image are mapped to new values. The histogram equalization technique has been used to enhance the contrast of an image. The module equalize_adapthist() is used by importing the sklearn library to perform the same.

Fig. 7
figure 7

Contrast enhancement of images (a covid 19, b Lung opacity, c MERS, d Normal, e Pneumonia, f SARS, g Tuberculosis, h Viral pneumonia)

3.4 Feature Extraction

In this study, feature extraction has been performed by first deriving contour features and segmenting the images to obtain the desired region from the image. During the contour features phase, images from eight classes were used to calculate morphological values for parameters using Eqs. (1) to (17). Table 3 displays all of the computed values.

$$ {\text{area}} = {\text{height * width}} $$
(1)
$$ {\text{perimeter}} = { }\sqrt {(\left( {{\text{x}}_{2} - {\text{x}}_{1} } \right)^{2} + \left( {{\text{y}}_{2} - {\text{y}}_{1} { }} \right)^{2} } $$
(2)
$$ {\text{epsilon}} = 0.1{\text{\,*\,cv}}2{\text{\,*\,arclength }}\left( {{\text{cnt}},{\text{True}}} \right) $$
(3)
$$ {\text{width}} = {\text{cv}}2.{\text{boundingRect}}\left( {{\text{cnt}}} \right) $$
(4)
$$ {\text{height}} = {\text{cv}}2.{\text{boundingRect}}\left( {{\text{cnt}}} \right) $$
(5)
$$ {\text{Aspect Ratio}} = { }\frac{{{\text{width}}}}{{{\text{height}}}} $$
(6)
$$ {\text{Extent}} = { }\frac{{\text{object area}}}{{\text{bounding rectangle area}}} $$
(7)
$$ {\text{Equivalent diameter}} = { }\sqrt {\frac{{4{\text{\,*\,contour area}}}}{{\uppi }}} $$
(8)
$$ {\text{Minimum value}} = {\text{cv}}2.\min () $$
(9)
$$ {\text{Maximum value}} = {\text{cv}}2.\max () $$
(10)
$$ {\text{Minimum value Location}} = {\text{cv}}2.{\text{minMaxLo}}() $$
(11)
$$ {\text{Maximum value Location}} = {\text{cv}}2.{\text{minMaxLo}}() $$
(12)
$$ {\text{Mean Color}} = {\text{cv}}2.{\text{mean}}() $$
(13)
$$ {\text{Extreme Leftmost point}} = {\text{tuple}}({\text{cnt}}({\text{cnt}}\left[ {:,:,0} \right].{\text{argmin}}()\left[ 0 \right]) $$
(14)
$$ {\text{Extreme Rightmost point}} = {\text{tuple}}({\text{cnt}}({\text{cnt}}\left[ {:,:,0} \right].{\text{argmin}}()\left[ 0 \right]) $$
(15)
$$ {\text{Extreme Topmost point}} = {\text{tuple}}({\text{cnt}}({\text{cnt}}\left[ {:,:,0} \right].{\text{argmin}}()\left[ 0 \right]) $$
(16)
$$ {\text{Extreme Bottommost point}} = {\text{tuple}}({\text{cnt}}({\text{cnt}}\left[ {:,:,0} \right].{\text{argmin}}()\left[ 0 \right]) $$
(17)
Table 3 Morphological values of different infectious images

After finding the morphological values of the pre-processed images, they were segmented to extract the features using the Otsu thresholding technique, as shown in Fig. 8. Otsu’s method is also known as the binarization algorithm, and a simple as well as effective automatic thresholding method. In this technique, two variances, σwc (within class) and σbc (between class), are calculated for all possible thresholds. If the pixel luminance is less than or equal to the threshold, the pixel value is replaced by 0 (black), else it is replaced by 1 (white) to obtain the binary or black/white image.

Fig. 8
figure 8

Images after applying Otsu technique (a covid 19, b Lung opacity, c MERS, d Normal, e Pneumonia, f SARS, g Tuberculosis, h Viral pneumonia)

3.5 Applied Models

In this section the brief description about the deep learning models which are being used is shown along with their architectural diagrams for the better understanding of the model.

EfficientNet: EfficientNets are the baseline network designed by researchers using neural architectures to automate the designs of neural networks. These networks use mobile inverted bottleneck convolution and have obtained excellent efficiency and accuracy based on floating point operations per second compared to simple convolution neural networks. At present, eight series of efficient Net are there, out of which only four are used in this research, i.e., EfficientNetB0, EfficientNetB1, EfficientNetB2, and EfficientNetB3 [44]. The architecture of EfficientNet is shown in Fig. 9.

Fig. 9
figure 9

Architecture of EfficientNetB0

NASNetLarge: NASNet is also called a Neural Architecture search network. It is a convolutional neural network trained on millions of images of the ImageNet database. This network takes the input image of size 331 by 331. Its building block consists of normal and reduction cells. Convolutional cells that return a feature map of the same dimension are referred to as normal cells, while the convolutional cells that return a feature where its width and height are reduced by two are called reduction cells. The controller RNN searches only the structures of (or within) the Normal and Reduction Cells (Recurrent Neural Network). The cells present in the normal or reduction cells consist of a number of blocks, and each block behaves as a CNN model [45]. Figure 10 shows the architecture of the NASNetLarge model.

Fig. 10
figure 10

Architecture of NASNetLarge [52]

DenseNet169: DenseNet is also called the dense convolutional network. It is architecture from one of the DenseNet group of models that has [6, 13, 45, 45] layers in the four dense blocks for classifying the image. This model has a deeper and denser network in which all the layers are connected with shorter connections to train and generate results efficiently [46]. Figure 11 shows the architecture of the DenseNet169 model.

Fig. 11
figure 11

Architecture of DenseNet169 [53]

ResNet152V2: ResNet152V2 is called a residual network having 152 layers. This model is used for extracting the features in the image by training the input image based on their pre-trained initial weights. The architecture of this model contains various layers such as reshape layer, flatter layer, first dense layer, dropout layer, second dense layer, and an activation layer for predicting the class of an image. Figure 12 shows the architecture of ResNet152V2 [47].

Fig. 12
figure 12

Architecture of ResNet152V2

InceptionResNetV2: The InceptionResNetV2 model is the hybridization of Inception and residual network architecture. The combination of this model has the advantage of retaining the unique features of the multi-convolutional core of the Inception network. The hybrid model is the improvised version of the Inception model that works on its performance by achieving better accuracy. Figure 13 shows the basic block diagram of InceptionResNetV2 [48].

Fig. 13
figure 13

Architecture of InceptionResNetV2

3.6 Evaluation Parameters

Accuracy: The parameter evaluates how accurately the model has been trained and tested to classify the image correctly [49]. It is calculated by the Eq. (18)

$$ {\text{Accuracy}} = \frac{{{\text{True\,Positive}} + {\text{True\,Negative}}}} {\text{True\,Positive} + {\text{True\,Negative}} + {\text{False\,Positive}} + {\text{False\,Negative}}} $$
(18)

Loss: It is the parameter that evaluates the bad prediction of the model when it is not trained or tested with the proper classes of the dataset. When the model is used to predict the test image and generates zero loss value, it works best, but if it generates more than zero, it means the model needs to be trained again [49]. It is calculated by the Eq. (19)

$$ {\text{Loss}} = \frac{{\left({\text{Actual}} - {\text{Predicted}} \right)^{2} }}{\text{{Total number of observations}}} $$
(19)

Precision: It is the parameter that tests the quality of a positive prediction made by the model. It is the ratio of true positives to the total number of positive predictions [50]. It is calculated by the Eq. (20)

$$ {\text{Precision}} = \frac{{{\text{True\,Positive}}}}{{{\text{True\,Positive}} + {\text{False\,Positive}}}} $$
(20)

Recall: The parameter is obtained by taking the ratio of positive samples which are correctly classified to the total number of positive samples [50]. It is calculated by the Eq. (21)

$$ {\text{Recall}} = ~\frac{{{\text{True\,Positive}}}}{{{\text{True\,Positive}}} + {\text{False\,Negative}}}$$
(21)

F1 score: It is the parameter that combines a classifier’s recall and precision by calculating their harmonic mean [51]. It is represented by Eq. (22)

$$ \text{F1 score} = \frac{{2\,*\,\text{Precision}\,*\,\text{Recall}}}{\text{Precision + Recall}} $$
(22)

4 Results and Discussion

This section presents the efficiency of the models, which are being evaluated for different disease datasets such as Covid 19, MERS, SARS, lung opacity, tuberculosis, pneumonia, viral pneumonia, and normal lung images using multiple evaluative parameters like accuracy, loss recall, precision, F1 score, root mean error square (RMSE). In addition, the graphical analysis of these models during training and testing phase has also been shown to study their performances. Bold signifies the best results for each parameter in Tables 4 and 5.

Table 4 Evaluation of models for different classes of disease dataset
Table 5 Analysing the models during training and testing phase

Table 4 evaluated the models using training and testing accuracy, loss, and RMSE for each class of the disease dataset separately. It can be observed that EfficientNetB0 and EfficientNetB1 obtain the best accuracy in training and predicting the covid disease by 88.09% and 84.91%, respectively. For diseases like Pneumonia, SARS, and Tuberculosis, EfficientNetB0 computed the best testing accuracies by 89.09%, 99.09%, and 95.37%, respectively. In contrast, the training accuracies for the same diseases have been obtained by InceptionResNetV2 by 86.59%, 96.59%, and 96.95%, respectively. In the case of MERS, the highest training and testing accuracies have been obtained by DenseNet169 at 98.42% and EfficientNetB1 at 88.91%. ResNet152V2 and InceptionResNetV2 have obtained the training and testing accuracy of classifying viral pneumonia by 89.89% and 86.59%, respectively. In the end, the accuracy of classifying normal lung images has been shown by EfficientNetB1 and EfficientNetB2 by obtaining 99.91% and 99.58% for the training and testing phase, respectively.

After evaluating the performance of the models for different classes of the disease dataset separately, we combined all the datasets into two sub-datasets, i.e., the training dataset and a testing dataset containing eight classes each, for analyzing the performances of the model, as shown in Table 5.

On assaying Table 5, the model trained well by the training dataset is EfficientNetB0 by computing 89.09% accuracy, 0.299 loss, and 0.546 RMSE value. Still, on the other hand, while testing the model, the best accuracy, loss, and RMSE values were obtained by InceptionResNetV2 by 88%, 0.399, and 0.631, respectively. NASNetLarge has computed the least testing scores with 50.35% accuracy, 1.344 loss, and 1.159 RMSE value. The models’ performances have also been graphically analyzed, as shown in Fig. 14.

Fig. 14
figure 14figure 14

Graphical analysis of models’ performance

The testing accuracy and loss of NASNetLarge have a flat line, indicating that the model cannot learn the testing dataset. The same flat line has also been generated for loss during the training phase by ResNet152 and InceptionResNetV2, which means that the model needs to be trained better by the dataset. The model accuracy of EfficientNetB1 and ResNet152V2 shows a huge gap between both curves, indicating that the training dataset provides insufficient information in case of learning the problem. In addition, the testing accuracies of the models such as EfficientNetB0, EfficientNetB1, EfficientNetB2, EfficientNetB3, and DenseNet169 show noisy movements around the training curves, indicating that the testing dataset needs to provide more.

In addition, the performance of the models has also been examined based on recall, precision, and F1 score value for the complete dataset as shown in Table 6.

Table 6 Performance evaluation of models

In the case of Precision, the highest value has been computed by NASNetLarge by 91%, and InceptionResNetV2 obtains the least by 68.5%. On the other hand, the highest recall value has been obtained by InceptionResNetV2 by 91.12%, and NASNetLarge has computed the lowest value by 83%. In the end, the best value of the F1 score has been generated by EfficientNetB0 by 89%, and the lowest is computed by NASNet Large with 64.87% again. Likewise, the precision, recall, and F1 score of deep learning models have been again computed for various disease dataset classes, as shown in Fig. 15.

Fig. 15
figure 15

Performance testing of models

From the figure, it has been assayed that the highest precision value has been obtained by efficientNetB0 for viral pneumonia with 0.99, efficientNetB1 for MERS and normal classes with 0.99, EfficientNetB2 for tuberculosis and viral pneumonia classes with 0.99 each, EfficientNetB3 for pneumonia with 0.97, NASNetLarge for SARS with 0.99, DenseNet169 for MERS and tuberculosis classes with 0.95 each, ResNet152V2 for MERS and viral pneumonia with 0.95 each and InceptionResNetV2 for MERS with 0.95. Likewise, the highest recall value has been obtained by efficient NetB0 for tuberculosis with 0.99, efficientNetB1 for pneumonia with 0.99, EfficientNetB2 for tuberculosis and normal classes with 0.94 each, EfficientNetB3 for normal and pneumonia with 0.99, NASNetLarge for normal with 0.94, DenseNet169 for MERS with 0.96, ResNet152V2 for Covid-19 and normal classes with 0.95 each and InceptionResNetV2 for SARS and tuberculosis with 0.99 each. In the end, the highest F1 score has been obtained by efficient NetB0 for viral pneumonia with 0.99, efficientNetB1 for pneumonia and viral pneumonia with 0.95, EfficientNetB2 for Pneumonia, and SARS classes with 0.99 each, EfficientNetB3 for SARS and viral pneumonia with 0.94, NASNetLarge for lung opacity, normal, and viral pneumonia with 0.68, DenseNet169 for viral pneumonia with 0.99, ResNet152V2 for tuberculosis with 0.91, and InceptionResNetV2 for normal, pneumonia, and viral pneumonia classes with 0.99 each.

Moreover, the computational time taken by the models has also been computed to understand which model took the maximum time to get trained by the complete dataset. EfficientNetB0 took 16 h 20 min, while EfficientNetB1, EfficientNetB2, and EfficientNetB3 took 12 h 10 min, 10 h, and 3 h 60 min, respectively. NASNetLarge took 10 h to get trained by the dataset, while DenseNet169 was trained in 1 h and 50 min. On the other hand, ResNet152V2 took 5 h 46 min, and InceptionResNetV2 got trained only in 8 h.

After computing the results of these applied deep learning models, their performance has been differentiated with the existing techniques, as shown in Table 7. The comparison has been made based on accuracy only, while the details regarding the dataset and techniques that have been used to detect and classify infectious diseases are also provided to understand it in a better way.

Table 7 Comparison of the current work with the existing techniques

5 Conclusion

Artificial intelligence based deep learning techniques have shown great potential by detecting and diagnosing infectious diseases. With the increasing availability of medical imaging data and the development of deep learning algorithms, the accuracy and efficiency of disease detection have significantly improved. However, there are also challenges to the use of deep learning in infectious disease detection, such as the need for large amounts of high-quality data, the risk of overfitting, and the lack of interpretability of some models. Nevertheless, the potential benefits of deep learning in infectious disease detection make it a promising area for further research and development. In this research, eight pre-trained models such as EfficientNetB0, EfficientNetB1, EfficientNetB2, EfficientNetB3, NASNetLarge, DenseNet169, ResNet152V2, and InceptionResNetV2 have been trained using the dataset of infectious diseases. After features were extracted, the dataset was split into training and testing data in a ratio of 75:25, and the models performed admirably in both phases. After the research was done, some limitations were noted, such as NASNetLarge did not learn the testing dataset very well and pre-processing the data and obtaining the ROI required a significant amount of computational time. In addition, overfitting has also been seen in the performance of specific models, which needs to be taken care in future. Despite the use of 29,252 images for training and testing the model, the accuracy of the deep learning models could be improved. Therefore, the hyperparameters of the models should be optimised in order to improve their performance accuracy. In fact, researchers can develop a unified platform capable of detecting all infectious diseases in the future. With the help of it, Public health officials will also respond more quickly and effectively to outbreaks of infectious diseases. In addition to this, by using this AI-based prediction and classification system, the analysis of data from multiple sources will help public health officials to predict the spread of infectious diseases and informs their response in a minimum time.