# FPGA-Based Deep Learning Models for Analysing Corona Using Chest X-Ray Images

Authors: Anupama Namburu; D. Sumathi; Roshani Raut; Rutvij H. Jhaveri; Rajesh Kumar Dhanaraj; N. Subbulakshmi; Balamurugan Balusamy
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Coronavirus is a large family of viruses that affects humans and damages respiratory functions ranging from cold to more serious diseases such as ARDS and SARS. But the most recently discovered virus causes COVID-19. Isolation at home or hospital depends on one’s health history and conditions. The prevailing disease that might get instigated due to the existence of the virus might lead to deterioration in health. Therefore, there is a need for early detection of the virus. Recently, many works are found to be observed with the deployment of techniques for the detection based on chest X-rays. In this work, a solution has been proposed that consists of a sample prototype of an AI-based Flask-driven web application framework that predicts the six different diseases including ARDS, bacteria, COVID-19, SARS,Streptococcus, and virus. Here, each category of X-ray images was placed under scrutiny and conducted training and testing using deep learning algorithms such as CNN, ResNet (with and without dropout), VGG16, and AlexNet to detect the status of X-rays. Recent FPGA design tools are compatible with software models in deep learning methods. FPGAs are suitable for deep learning algorithms to make the design as flexible, innovative, and hardware acceleration perspective. High-performance FPGA hardware is advantageous over GPUs. Looking forward, the device can efficiently integrate with the deep learning modules. FPGAs act as a challenging substitute podium where it bridges the gap between the architectures and power-related designs. FPGA is a better option for the implementation of algorithms. The design attains 121µW power and 89 ms delay. This was implemented in the FPGA environment and observed that it attains a reduced number of gate counts and low power.


---

## Body

## 1. Introduction

Coronavirus disease 2019 (COVID-19) pandemic is a global challenge. This new respiratory virus has put an unprecedented load on health care systems in the world due to the exponential increase in the number of patients with COVID-19. In many countries, there are a limited number of diagnosis kits, personal protective equipment (PPE) kits, hospital beds for such patients, and limited ventilators. Also, infected individuals are often asymptomatic for many days. So, early identification of infected individuals can enable quarantining of the individuals and thus control the spread of the disease. It has been inferred from various reports that there are more individuals infected with COVID-19 who experience direct respiratory ailment, whereas a few others met with destructive pneumonia. There are a few conventions that the aged people who have a history of diseases that are associated with diabetes, infections in the respiratory, and malicious growth tend to be associated with the other genuine disease [1]. In the era of 1990s, neural networks were implemented in FPGA. Based on the analysis made in the first FPGA implementations, some of the constraints were identified such as expensive resources, low-precision arithmetic, and size of FPGA. Then, FPGA implementations of CNN also improved. Significantly, FPGA technology has been implemented as back propagation in 2006, OpenCL support for FPGAs by Altera in 2011, and a large-scale FPGA based research is established. When implementing deep learning on FPGAs, it achieves low emphasis in adapting algorithms for certain computational methods.There are three types of tests available for the detection of the virus. The first one is the molecular test also known as the real-time reverse transcription-polymerase chain reaction (RT-PCR). Most molecular test swabs must be kept within a certain temperature range so that the test will be accurate. The sample must arrive at the lab within 72 hours. It had a relatively low positive rate in the evaluation of COVID-19 (named by the World Health Organization). The second one is the antigen test and which is also known as a rapid diagnostic test. The sample is taken from the nasal or throat swab. With this test, positive results are usually highly accurate, but negative results may need to be confirmed with a molecular test. The third test is an antibody test which is also identified as serology or blood test. Antibody tests may provide quick results but should not be used to diagnose an active infection. The objective of the antibody tests is to only detect antibodies the immune system develops in response to the virus, not the virus itself. It can take days to several weeks to develop enough antibodies to be detected in a test. Due to the low sensitivity rate (60%–70%) of the above traditional tests, even if negative results are obtained, symptoms can be detected by examining radiological images of the patients. Chest radiological imaging such as computed tomography (CT) and X-ray have vital roles in the early diagnosis and treatment of this disease. The use of X-rays has several advantages over conventional diagnostic tests such as cost-effective, fast diagnostic results as it does not require any transportation from the acquisition, reduction of the requirement of additional PPE kits, and less risk due to the isolation ward for portable X-ray machines. This is not that easy as a model needs to make even minor parts of the X-ray into scrutiny and classify the state of a person. FPGA is an ideal choice for designing low power and high-speed architectures which is helpful for the futuristic deep learning method. High level of abstraction on FPGAs is easy to program in reconfigurable structures and parallel process makes to achieve high speed.The main contributions to this work have been stated as follows:(i)
The developed model uses the convolution neural network, a deep learning model, to classify the diseases from the given image.(ii)
The prediction is of seven categories that include normal, ARDS, bacteria, COVID-19, SARS,Streptococcus, and virus.(iii)
Based on the prediction, one can ensure his/her medical condition and may take necessary precautions to prevent the severe conditions in the earlier stage itself, which is the main goal of this work.(iv)
The proposed deep learning architectures ensure the benefits through the deployment of FPGAs since the reconfigurability that allows the architectures to be customized and the parallelism has been carried out to quicken the execution speeds.This work has been organized into various sections. Section2 briefs about the works that have been carried out by many researchers earlier in this field. Section 3 provides the readers with a detailed illustration of the methodologies that have been deployed. The results were discussed in Section 4. Finally, the authors have concluded with the inferences observed.


## 2. Related Works

Researchers have deployed various deep learning techniques for the detection of pneumonia, and additionally, the classification of viral and bacterial pneumonia in 2D pediatric chest radiographs is also performed. The authors [2] have devised a prediction model that uses a deep convolution neural network and prepared trained models such as Inception-ResNetV2, ResNet50, and Inception-ResNetV2. Innovations observed from this work were as follows:(1)
End-to-end structure that does feature selection and extraction automatically(2)
Among the other pretrained models, ResNet50 is found to be an efficient model(3)
The best tool used for detecting COVID-19 is the chest X-ray images(4)
Through the pretrained models, it has been proven that it results in high accuracy when the model is examined on the small dataset (50 COVID-19 vs. 50 normal)Determination of COVID-19 persons could be done by investigating the chest X-ray images with the help of machine learning techniques. In [3], a method has been devised to classify the chest X-ray image that depends on the combination of the image descriptor (fractional multichannel exponent moments) FrMeMs and the improved attribute selection that depends on manta-ray foraging optimization and differential evolution (MRFODE). The first technique is used to excerpt the X-ray images of the chest. Then, it is partitioned into the training and testing sets. The inappropriate and redundancy features are removed by the deployment of MRFODE. Through this procedure, a group of solutions is obtained, and the fitness value is computed for all the solutions by applying the KNN classifier on training datasets. Later, the probability of each solution is calculated with the fitness value. The solutions are improved by the deployment of differential evolution or the functions of MRFO. Modifications are done until it reaches the termination condition. It is identified as the best solution for eradicating the inappropriate features, and thus the labels for the image dataset are calculated. The proposed technique showed that there is an accuracy of 96.09% and 98.09% for the datasets correspondingly.A deep learning neural network model CoroNet has been proposed in [4] for the automatic detection of infection from the chest X-ray images. The principle behind this model is the Xception architecture that is pretrained on the ImageNet dataset. It is trained completely on the training dataset of COVID-19 and other chest pneumonia X-ray images. The model is deployed to categorize the pneumonia types such as viral pneumonia, bacterial pneumonia, and COVID-19 pneumonia. The results are compared for further analysis. This model facilitates doctors during the triage and in monitoring the positive cases. An average accuracy is 89.6% on each fold, whereas certain metrics such as F1-Score, precision, recall, and average accuracy obtained are 95.61%, 93.17%, 98.25%, and 96.6% for the 4-class CoroNet Model. A few modifications to the model have been done, and the parameters are tuned in such a way that it is tested on three classes only. The overall accuracy has been improved to 94.95% after the combination of the two non-COVID-19 pneumonia infections.In [5], five various data repositories such as COVID-19 Image data collection [6], Chest X-ray dataset initiative [7], ActualMed COVID-19 Chest X-ray Dataset initiative [8] collaborated with ActualMed, COVID-19 radiography database [9], and RSNA Pneumonia detection challenge dataset [10] that uses the widely available data [11] have been collected and modified. The dataset is constructed by obtaining certain patient cases from all repositories and they are described as follows:(i)
Patients who suffer from COVID-19 and the pneumonia patient cases from the COVID-19 image data collection.(ii)
COVID-19 patients from the Chest X-ray dataset initiative and the ActualMed dataset Initiative.(iii)
Normal cases and pneumonia patients who do not have pneumonia, but suffer from RSNA pneumonia detection challenge dataset, and finally, patients’ information has been extracted from the radiography database. From the experimental results, it has been observed that the model shows a test accuracy of 93.3%.Prior diagnosis of patients infected with COVID-19 is done by the deep learning models combined in a framework named COVIDX-Net [12]. The cost of analysis is less than the testing that has been done on traditional chest X-ray images. With the small datasets, the accuracy obtained is good, and thereby, the classification is done efficiently. The proposed framework is built on seven deep learning classifiers such as ResNetV2, Xception, VGG19, InceptionV3, DenseNet121, and Inception-ResNetV2. From the experimental results, the performance scores obtained through the deployment of DenseNet201 and VGG19 proved to be the best score.The authors [13] have focused on detecting the newly emerged virus with a framework based on deep learning. The framework is used to retrieve the local and overall features. Detection is made possible with the help of raw chest X-ray images. From the results, the classification accuracy obtained for the binary classification is 98.08% and 87.02% for multiclass classification. The classifier implemented by the authors was a DarkNet Model, and 17 convolutional layers have been deployed in this framework. Additionally, filtering concepts have been used on each layer. A three-dimensional deep learning framework has been recommended in [14]. In this COVID-19 detection neural network (COVNet), the model is tested with various images such as community-acquired pneumonia (CAP) and other nonpneumonia lung diseases. RestNet50 [15] supports the framework in which a series of CT slices is provided as the input, and thereby, features are generated based on it. The features thus extracted are joined with the help of maxpooling operation. Finally, the feature map thus generated is given as an input to the fully connected layer. The probability score is created through the softmax activation function for all types. As per the convention strategy, the CT image is first preprocessed, and the lung region is extracted through the Unet [16] depending on the segmentation method. Finally, the predictions are performed. CNN has been combined with the other techniques to form a hybrid model which could be used for extracting the cervical images [17]. In the study [18] performed by the authors, the dataset has been created with 5,000 images of chest X-ray images. Testing is done on images that show a clear sign. Four deep learning models are deployed on the training dataset, and the performance is examined on the test set. The transfer learning method was implemented so that the fine-tuning of models has been done on the COVID-19 X-ray 5k dataset. The test set comprises 3000 images. Through this, performance metrics such as sensitivity and specificity are measured. It shows a rate of 98% and 92%, respectively. Various other metrics such as precision-recall and receiver operating characteristics (ROC) are measured. Additionally, the authors have shown the analysis through the heat maps that show the infected area concerning COVID-19 by this devised deep visualization method. In [19], a concatenated neural network has been devised based on the principle of Xception and ResNet50V2 networks to classify the chest X-ray images. Infection due to ARDS, pneumocystis, Streptococcus, SARS, and several other kinds of pneumonia have been shown in the dataset through the X-ray and CT scan images. An accuracy of 99.50% and 80.53% has been obtained for COVID-19, and also, the accuracy 0f 91.4% is achieved among five folds. A classification model has been suggested by the authors [20] to categorize the patients from chest CT images. In this study, the dataset is segregated into the training and test dataset. The proposed model works based on the principle of MODE-based CNN. Overfitting is provided by the utilization of 20-fold cross-validation. Several factors are taken into the consideration for comparing the proposed classification model. From the experimental results, the deployed ANN, ANFIS, and CNN models show an improvement in F-measure, sensitivity, specificity, and accuracy of 2.0928%, 1.8262%, 1.6827%, and 1.9789% correspondingly.Prediction of the number of patients who are infected with COVID-19 has been done with the deployment of ML models. In this work [20], models such as least absolute shrinkage and selection operator (LASSO), linear regression (LR), exponential smoothing, and support vector machine (SVM) have been used in the prediction of the factors that cause threats in COVID-19. Predictions like the death rate, recoveries count, and the number of new infections are done. From the experimental results, it has been proven that the performance of exponential smoothing is better when compared with the other models. LR and LASSO models perform better when compared with the SVM. In the proposed work [21], a deep convolutional neural network (CNN) is used for detecting COVID-19 patients. Experimental results showed an F-measure of 95–99%. Inferences were made from 1000 X-ray images of patients. Predictions were done based on the methods such as the prophet algorithm (PA), autoregressive integrated moving average (ARIMA) model, and long short-term memory neural network (LSTM). Through this, the count of deaths, recovery rate, and confirmation cases were also determined. The average accuracy of 94.80% and 88.43% has been achieved through this model. Thus, the most affected cities have been identified, and it has been observed that the number of cases is more in the coastal areas when compared with the noncoastal areas. Detection of coronavirus with the help of X-ray images has been done with the deployment of the deep learning model. The model [22] made use of SVM to categorize the infected images through deep features. It proves an accuracy, kappa, MCC, FPR, and F1 score as 95.38%, 90.76%, 91.41%, 6.5%, and 95.52% correspondingly. From various inferences, it has been shown that ResNet50 with SVM has shown a remarkable performance when compared with other classifiers. Synthetic chest X-ray images have been constructed with the help of an auxiliary classifier generative adversarial network (ACGAN) based model called COVIDGAN [23]. The performance of the model has been augmented, and thus 85% of accuracy has been achieved. Accuracy is increased by 10% through the inclusion of synthetic images that has been constructed from the model. Noticeable constraints such as challenges, issues of COVID-19, and state-of-art of methods are summarized in [24]. A comparison of a few works is shown in Table 1.Table 1
Comparison of a few works.
S. no.ModelInferences1Xception and ResNet50V2 [18]X-ray imagesLearning used is transfer learningPrecision is low, and the dataset is unbalancedAccuracy is better2Decompose, transfer, and compose (DeT raC) modelX-ray imagesLearning used is transfer learningAccuracy: 95.12%3COVIDGANSynthetic X-ray imagesAccuracy: 95%4AlexNet, GoogLeNet, Squeeznet, and ResNet18 are selected as deep transfer learning modelsX-ray images of two categories, namely, normal and pneumoniaAn appropriate model that shows an accuracy of 99%Many works have been focused recently on the utilization of convolutional neural networks (CNNs) to solve common problems in the field of image classification. CNNs were built at first to classify the images; they do so by using successive layers of convolutions and pooling. When training a traditional CNN, more focus has been done to check whether the model predicts the right classification or not. The pooling layer in a convolutional block is used to reduce the data dimension and achieve something called spatial invariance, which means regardless of where the object is placed in the image, it identifies the object and classifies it. Authors in [25] discussed the tool flow mapping of CNN and FPGA based on compatibility performance density, arithmetic precision, and optimization objectives. Numerous FPGA designs are implemented for the CNN-based algorithms for high optimizations in RTL [26, 27]. The proposed CNN model is scrutinized concerning the architecture of the hardware elements based on arithmetic operations involved in the design and implemented in the FPGA platform [28]. Based on the implementations, the metrics performance is observed from the results. Furthermore, FPGA behaves as an intelligent gateway in the Industrial Internet of Things (IIoT) where the tasks such as the data that emerges from various sensors have to be aggregated, and the FPGA-based intelligent gateway designing finally develops the control unit to manage the sensors and other subcomponents [29]. Deep learning shows its performance in domains such as telecommunication, human resource management, and smart metering.


## 3. Deep Learning Architectures

### 3.1. CNN Model Structure

This section discusses the complete architecture and working of the model that classifies the state of chest X-ray. Machine learning algorithms are widely being used for the classification of images and data, etc. However, in this work, a deep learning algorithm—convolutional neural network (CNN) technique—has been proposed to predict the coronavirus using chest X-ray images. Among the available deep learning algorithms, the objective of choosing the CNN is that the performance of the CNN outperforms when compared with the other conventional techniques. The basic working of CNN would be like a categorical value of inputs (segregated images) was taken and then resizing of images is done with an image data generator. Later, the data is being passed through various layers of CNN, and prioritization is done. In this work, pneumonia is considered along with the other patterns in the image and thereby classifies/differentiates each category of images (chest X-rays). The model architecture is depicted in Figure1.Figure 1
Model architecture.Figure2 states the image processing application with FPGA Architecture. The input image values are given to data preprocessing and CNN algorithm. Then, it is implemented in FPGA through DDR memory. The CNN is a combination of convolutional layers and a neural network. To deploy it, Keras—a Neural Network library—that works as a wrapper to low-level libraries like TensorFlow is used. There are two types of models in Keras, namely, sequential and functional. The sequential is chosen over functional because the sequential model deals with the linear stack of layers, whereas the functional model deals with the arbitrary graph of layers. The sequential Keras model contains the maxpooling layer, convolution layer, and flatten layer. Here, the neural network consists of 4 layers which are the input layer, convolutional layer, pooling layer, and dense layer. The Dense Layer contains 3 more layers which are input layer, hidden layer, and the output layer. A specific approach has been adopted, and the traditional convolutional network—rectified linear unit (ReLU)—as the activation function has been implemented to extract the basic features of the image so that the model could predict the accuracy perfectly. The input image provided to the input layer is resized to 150 × 150 after applying the initial preprocessing step. Each pixel is considered as xi. The input layer is of size 150 ∗ 150 ∗ 3. The activation of a node defines the output of that node given a set of inputs. The rectified linear unit is the most commonly used in deep learning models. This is the basic functionality that returns 0 if a negative value as input is given, and if the positive input is given, it returns the particular value.Figure 2
FPGA architecture.The activation function of the 7 output dimensions used is softmax as the final layer in the proposed model. The softmax activation function is normally applied to the very last layer in the neural network. Figure3 shows the sample chest X-ray dataset. The significant feature of the softmax is that it converts the output of the last layer in the network into what is essentially a probability distribution. The softmax activation function is given by the following equation:(1)softmax=SMxi=exi∑j=1nexi.Figure 3
Sample chest X-ray dataset [30].The loss of the proposed model is predicted with the cross-entropy given by(2)Lossp,e=−∑pxilogexi,where p is the probability distribution of each pixel.The proposed method is graphically represented in Figure4. It has convolution, pooling rectified linear units, and fully connected layers.Figure 4
Proposed CNN model.


### 3.2. ResNet Model Structure

This section discusses the complete architecture of the deep learning model used, i.e., residual network (ResNet) without dropout. ResNet is one of the applications of transfer learning. The best part of ResNet is that the algorithm can classify almost 1000 plus categories of the dataset. In the proposed model, ResNet50 is used.The model (ResNet) consists of identity blocks and convolutional blocks of 5 stages each. The convolutional block has a further 3 layers, and thereby the identity block has 3 convolutional layers. The basic working of ResNet would be like taking a categorical value of inputs (segregated images) and then resizing the images with an image data generator. Later, the series of layers is passed such that the algorithm finds/identifies the unique patterns among the categories of images.For the last layer to be added in the model, there are a few layers passed as input layers. The input layers are the lambda layer, dense layer, and flatten layer. All these layers create a sequential model by passing a list/stage of layer instances to Keras. It works as a wrapper to low-level libraries like TensorFlow. The proposed ResNet model also follows the linear stack of layers.The input image provided to the input layer is resized to 244 ∗ 244 after applying the initial preprocessing step. Then, the path for both the train data and valid (test) data must be passed. Later, the last layer has to be removed, and the required categories have to be correspondingly set. The first step is to initialize the input shape as image size (224, 224)+ [3]. Here, 3 indicates that the dataset of images contains RGB images which are a nongrey scale. Weights of the layers are being given through the inbuilt function ImageNet. For removing the last layer, include_top = “False” must be given, such that the removed layer can be used for transfer learning.Algorithm 1 is given for the proposed ResNet.(1)
X -> input features Y -> Label X -> {X1, X2, …, Xn}(2)
D = ∑i=1nXi,Yi. Here, D represents the dimensions.(3)
∑i=1ndi, where n = 3.(4)
P > filter size (a ∗ a)(5)
Output -> ((X, Y) + 2 ∗ Q − P)/S + 1)) ∗ ((X, Y) + 2 ∗ Q − P)/S + 1))Here, the input features are considered as “X” and labels as “y.” S is the stride that has been applied on (X, Y). Optimization problem is solved with the help of tuning the parameters. The objective function is denoted as ‘P’ that is been provided to the network architecture. To tune weights and bias, there exists a parameter “p” that could be used for training on the dataset. The objective is to do the optimization to achieve a better outcome. As weights are fixed, this model does not have to train all the layers of the ResNet because it is a state of heart algorithm. Training all the layers makes the model reduce the accuracy because ResNet has been trained in many images. A lot of resources and GPU are required to train them. To avoid all these, the proposed model made sure that every single layer in the ResNet layer is not training. Now, the last layer is flattened and appends the number of classes. As a dense layer with an activation function, softmax is assigned to a variable name prediction. The proposed method is graphically represented in Figure 5.Figure 5
Proposed ResNet method.


### 3.3. VGG16 and ALEXNET Model Structure

This section discusses the VGG16 and AlexNet model used as a comparison among deep learning algorithms CNN and ResNet. Visual Geometry Group (VGG16) is also known as OxfordNet. VGG16 is a convolutional neural network that is considered as one of the excellent vision model architectures and is 16 layers deep. It has a large number of hyperparameters mainly focused on convolutional layers of 3 × 3 filter layer with stride 1 and always used the same padding and maxpooling layer of 2 × 2 filter of stride 2. It has almost 138 million parameters, whereas ResNet has only 25.5 million parameters. The final layer has two fully connected layers and then is followed by softmax for the output. The steps of VGG16 from initialization to compilation are as follows, and then a sequential model is initialized.image data generator functions are used to rescale, rotate, zoom, flip the images, and label the data inside the folder. Later, the convolutional layers, maxpooling layers of Keras, and padding are added. The ReLU activation layer is added to all the layers so as to stop the negative values being entering the next layers. To flatten the vector that comes out of convolutions, the data is passed to dense layers. Finally, the softmax layer is passed for the output. The proposed VGG16 method is graphically represented in Figure6.Figure 6
Proposed VGG16 method.One of the algorithms used to overcome the problem of image classification is AlexNet. It is made up of sixty million parameters. If the input size of the RGB image is 224 × 224, all of the training and test set images will be 224 × 224. AlexNet’s architecture is shown in the figure. It is observed that AlexNet consists of 1 softmax layer, 2 fully connected layers, 3 overlapping maxpooling layers, 2 normalization layers, and 5 convolutional layers from the architecture shown in Figure6. Each convolution layer of the same image size has various kernel numbers. Initially, if we understand the architecture, a convolution layer of stride = 4 with 96 kernels of size 11 × 11 was used by overlapping the maxpooling layers of size 3 × 3 with the next step = 2. Convolution layer 5 × 5 with padding size = 2 of 256 kernels have been completed. The overlapping maxpooling layer of phase = 2 with the image size of 3 × 3 follows it again. Then, three 384 kernel convolution layers of size 3 × 3 with padding size 2 are directly connected. An overlapping maxpooling layer of size 3 × 3 with phase = 2 follows next to it. Now, about two fully connected 4096 unit layers that follow with an output layer, 1000-way SoftMax.This provides about 1000 class labels to be distributed. Each convolution layer, together with a nonlinear activation function, i.e., ReLU, contains convolution filters. ReLU is added after every convolution layer and the fully connected layer. Dropout is applied before the two fully related layers. Dropout is a technique developed by G. E. Hinton where a neuron is dropped from a network so that either forward or backward propagation does not participate. This raises the number of iterations and will greatly overfit the model without dropouts. The accuracy obtained via this model of AlexNet is relatively weak. Therefore, to increase the detection rate, this results in deploying another model. The proposed AlexNet method is graphically represented in Figure7.Figure 7
Proposed AlexNet method.


## 3.1. CNN Model Structure

This section discusses the complete architecture and working of the model that classifies the state of chest X-ray. Machine learning algorithms are widely being used for the classification of images and data, etc. However, in this work, a deep learning algorithm—convolutional neural network (CNN) technique—has been proposed to predict the coronavirus using chest X-ray images. Among the available deep learning algorithms, the objective of choosing the CNN is that the performance of the CNN outperforms when compared with the other conventional techniques. The basic working of CNN would be like a categorical value of inputs (segregated images) was taken and then resizing of images is done with an image data generator. Later, the data is being passed through various layers of CNN, and prioritization is done. In this work, pneumonia is considered along with the other patterns in the image and thereby classifies/differentiates each category of images (chest X-rays). The model architecture is depicted in Figure1.Figure 1
Model architecture.Figure2 states the image processing application with FPGA Architecture. The input image values are given to data preprocessing and CNN algorithm. Then, it is implemented in FPGA through DDR memory. The CNN is a combination of convolutional layers and a neural network. To deploy it, Keras—a Neural Network library—that works as a wrapper to low-level libraries like TensorFlow is used. There are two types of models in Keras, namely, sequential and functional. The sequential is chosen over functional because the sequential model deals with the linear stack of layers, whereas the functional model deals with the arbitrary graph of layers. The sequential Keras model contains the maxpooling layer, convolution layer, and flatten layer. Here, the neural network consists of 4 layers which are the input layer, convolutional layer, pooling layer, and dense layer. The Dense Layer contains 3 more layers which are input layer, hidden layer, and the output layer. A specific approach has been adopted, and the traditional convolutional network—rectified linear unit (ReLU)—as the activation function has been implemented to extract the basic features of the image so that the model could predict the accuracy perfectly. The input image provided to the input layer is resized to 150 × 150 after applying the initial preprocessing step. Each pixel is considered as xi. The input layer is of size 150 ∗ 150 ∗ 3. The activation of a node defines the output of that node given a set of inputs. The rectified linear unit is the most commonly used in deep learning models. This is the basic functionality that returns 0 if a negative value as input is given, and if the positive input is given, it returns the particular value.Figure 2
FPGA architecture.The activation function of the 7 output dimensions used is softmax as the final layer in the proposed model. The softmax activation function is normally applied to the very last layer in the neural network. Figure3 shows the sample chest X-ray dataset. The significant feature of the softmax is that it converts the output of the last layer in the network into what is essentially a probability distribution. The softmax activation function is given by the following equation:(1)softmax=SMxi=exi∑j=1nexi.Figure 3
Sample chest X-ray dataset [30].The loss of the proposed model is predicted with the cross-entropy given by(2)Lossp,e=−∑pxilogexi,where p is the probability distribution of each pixel.The proposed method is graphically represented in Figure4. It has convolution, pooling rectified linear units, and fully connected layers.Figure 4
Proposed CNN model.


## 3.2. ResNet Model Structure

This section discusses the complete architecture of the deep learning model used, i.e., residual network (ResNet) without dropout. ResNet is one of the applications of transfer learning. The best part of ResNet is that the algorithm can classify almost 1000 plus categories of the dataset. In the proposed model, ResNet50 is used.The model (ResNet) consists of identity blocks and convolutional blocks of 5 stages each. The convolutional block has a further 3 layers, and thereby the identity block has 3 convolutional layers. The basic working of ResNet would be like taking a categorical value of inputs (segregated images) and then resizing the images with an image data generator. Later, the series of layers is passed such that the algorithm finds/identifies the unique patterns among the categories of images.For the last layer to be added in the model, there are a few layers passed as input layers. The input layers are the lambda layer, dense layer, and flatten layer. All these layers create a sequential model by passing a list/stage of layer instances to Keras. It works as a wrapper to low-level libraries like TensorFlow. The proposed ResNet model also follows the linear stack of layers.The input image provided to the input layer is resized to 244 ∗ 244 after applying the initial preprocessing step. Then, the path for both the train data and valid (test) data must be passed. Later, the last layer has to be removed, and the required categories have to be correspondingly set. The first step is to initialize the input shape as image size (224, 224)+ [3]. Here, 3 indicates that the dataset of images contains RGB images which are a nongrey scale. Weights of the layers are being given through the inbuilt function ImageNet. For removing the last layer, include_top = “False” must be given, such that the removed layer can be used for transfer learning.Algorithm 1 is given for the proposed ResNet.(1)
X -> input features Y -> Label X -> {X1, X2, …, Xn}(2)
D = ∑i=1nXi,Yi. Here, D represents the dimensions.(3)
∑i=1ndi, where n = 3.(4)
P > filter size (a ∗ a)(5)
Output -> ((X, Y) + 2 ∗ Q − P)/S + 1)) ∗ ((X, Y) + 2 ∗ Q − P)/S + 1))Here, the input features are considered as “X” and labels as “y.” S is the stride that has been applied on (X, Y). Optimization problem is solved with the help of tuning the parameters. The objective function is denoted as ‘P’ that is been provided to the network architecture. To tune weights and bias, there exists a parameter “p” that could be used for training on the dataset. The objective is to do the optimization to achieve a better outcome. As weights are fixed, this model does not have to train all the layers of the ResNet because it is a state of heart algorithm. Training all the layers makes the model reduce the accuracy because ResNet has been trained in many images. A lot of resources and GPU are required to train them. To avoid all these, the proposed model made sure that every single layer in the ResNet layer is not training. Now, the last layer is flattened and appends the number of classes. As a dense layer with an activation function, softmax is assigned to a variable name prediction. The proposed method is graphically represented in Figure 5.Figure 5
Proposed ResNet method.


## 3.3. VGG16 and ALEXNET Model Structure

This section discusses the VGG16 and AlexNet model used as a comparison among deep learning algorithms CNN and ResNet. Visual Geometry Group (VGG16) is also known as OxfordNet. VGG16 is a convolutional neural network that is considered as one of the excellent vision model architectures and is 16 layers deep. It has a large number of hyperparameters mainly focused on convolutional layers of 3 × 3 filter layer with stride 1 and always used the same padding and maxpooling layer of 2 × 2 filter of stride 2. It has almost 138 million parameters, whereas ResNet has only 25.5 million parameters. The final layer has two fully connected layers and then is followed by softmax for the output. The steps of VGG16 from initialization to compilation are as follows, and then a sequential model is initialized.image data generator functions are used to rescale, rotate, zoom, flip the images, and label the data inside the folder. Later, the convolutional layers, maxpooling layers of Keras, and padding are added. The ReLU activation layer is added to all the layers so as to stop the negative values being entering the next layers. To flatten the vector that comes out of convolutions, the data is passed to dense layers. Finally, the softmax layer is passed for the output. The proposed VGG16 method is graphically represented in Figure6.Figure 6
Proposed VGG16 method.One of the algorithms used to overcome the problem of image classification is AlexNet. It is made up of sixty million parameters. If the input size of the RGB image is 224 × 224, all of the training and test set images will be 224 × 224. AlexNet’s architecture is shown in the figure. It is observed that AlexNet consists of 1 softmax layer, 2 fully connected layers, 3 overlapping maxpooling layers, 2 normalization layers, and 5 convolutional layers from the architecture shown in Figure6. Each convolution layer of the same image size has various kernel numbers. Initially, if we understand the architecture, a convolution layer of stride = 4 with 96 kernels of size 11 × 11 was used by overlapping the maxpooling layers of size 3 × 3 with the next step = 2. Convolution layer 5 × 5 with padding size = 2 of 256 kernels have been completed. The overlapping maxpooling layer of phase = 2 with the image size of 3 × 3 follows it again. Then, three 384 kernel convolution layers of size 3 × 3 with padding size 2 are directly connected. An overlapping maxpooling layer of size 3 × 3 with phase = 2 follows next to it. Now, about two fully connected 4096 unit layers that follow with an output layer, 1000-way SoftMax.This provides about 1000 class labels to be distributed. Each convolution layer, together with a nonlinear activation function, i.e., ReLU, contains convolution filters. ReLU is added after every convolution layer and the fully connected layer. Dropout is applied before the two fully related layers. Dropout is a technique developed by G. E. Hinton where a neuron is dropped from a network so that either forward or backward propagation does not participate. This raises the number of iterations and will greatly overfit the model without dropouts. The accuracy obtained via this model of AlexNet is relatively weak. Therefore, to increase the detection rate, this results in deploying another model. The proposed AlexNet method is graphically represented in Figure7.Figure 7
Proposed AlexNet method.


## 4. Comparison: Resnet, VGG16, and ALEXNET

Applying image classification in medical fields is not a new technique. Researchers around the world use different deep learning image classification algorithms, such as CNN and ResNet. The residual network (ResNet) with a dropout algorithm makes it possible to train up to thousands of layers or even more and still achieves convincing performance. It remained an amazing algorithm in the deep learning community. Almost all researchers dived into the algorithm to discover the secrets of success. Thus, ResNet is also included in the proposed project. While the algorithm is a powerful concept, it does have some drawbacks. However, for a particular type of model to be implemented, increasing the depth of the network, that is, stacking layers, may work. The same image data is used for CNN and ResNet, VGG16, and AlexNet. CNN algorithm got a 72% test precision for 20 epochs, while ResNet with dropout got 84% test precision for even 15 epochs each, whereas VGG16 resulted in 72% of test precision for 50 epochs; finally, AlexNet resulted in 46% test precision for 100 epochs. To our surprise, ResNet without dropout resulted in 98% test precision for only 5 epochs, which is the best and most considerable model among all. Even though the dataset is chest X-ray images and it has fewer levels of patterns, ResNet itself has proven to be one of the best models in many applications, the downside is that the deepest network would require weeks of training and assume that the other reason with the residual network for high accuracy would be with weight initializations.VGG16 was a pretrained model which is trained for 1000 class classification, while the proposed project is used only for 7 class classifications. The algorithm also has so many weight parameters in which the models are very heavy that result in extensive inference time. These are the factors that might be the cause for the low accuracy under-fit model when compared to ResNet50 and CNN algorithms.Compared to the models used in the analysis, AlexNet model has low depth and therefore, it is difficult for the algorithm to learn features of a set of this chest X-ray images. Table2 states the frameworks of neural networks with different FPGA target device.Table 2
Frameworks with the FPGA target device.
SystemNeural networkTarget deviceCaffeine [31]CNN and DNNXilinx StandaloneFFTCodeGen [32]CNN and DNNIntel HARPSysArrayAccel [33]CNN and DNNIntel StandaloneSnowflake [34]CNN, Res, and IncepXilinx SoCFP-DNN [35]CNN, RNN, DNN, and ResIntel StandaloneAutoCodeGen [36]CNN and DNNXilinx StandaloneFinn [37]BNNXilinx SoCStandalonefpgaConvNet [38, 39]CNN, Res, Incep, and DenseXilinx SoCDeepBurning [40]CNN, RNN, and DNNXilinx SoC


## 5. Results and Discussion

The proposed approach is validated using the IEEE8023—COVID chest X-ray dataset. Figure2 shows the sample dataset. Firstly, the actual data given is 5,935 images in which, the images are split into 5252 train images and 683 test images. Since the given data is not classified in a raw format and based on the detailed description of metadata of all the images given, segregation of the complete data is done. A few of the categories like ARDS and SARS has very few amounts of data, whereas bacteria and virus have a very large amount of data.The dataset of IEEE8023 contains 7 different classes of images, namely, ARDS, bacteria, COVID-19, normal, SARS,Streptococcus, and virus. Table 3 states the count images dataset using the deep learning algorithm.Table 3
The count of images dataset which is validated using a deep learning algorithm.
S. no.LabelLabel_1_virus_categoryLabel_2_virus_categoryImage_count1Normal15762PneumoniaStress smokingARDS23PneumoniaVirus14934PneumoniaVirusCOVID-19815PneumoniaVirusSARS46PneumoniaBacteria27727PneumoniaBacteriaStreptococcus5The experimentation is performed by 80% of the training data and 20% of the testing dataset.The ResNet (without dropout) model is considered for further proceedings with web application development since it topped the test precision accuracy of 98%.Figure8 shows the accuracy of the proposed network regarding epochs, i.e., accuracy vs. epochs. Figure 9 shows the loss vs. epochs comparison of the ResNet (without dropout) model.Figure 8
Accuracy vs. epoch.Figure 9
Loss vs. epoch.


## 6. User Interface

Once the model is built, a UI is developed using HTML, CSS, and JavaScript. Later, a Python Flask file is developed. Flask is a web application that would be used to interlink the back-end and front-end. Finally, the proposed model is integrated into the web page with the deep learning model using Flask. Figure10 shows the actual web page UI of the proposed work. The images are uploaded here for the prediction, and immediately, the results are obtained.Figure 10
The proposed web page user interface.Figure11 shows the COVID-19 chest X-ray image prediction through the user interface. The predicted results are displayed as the output from the CT lung images.Figure 11
COVID-19 chest x-ray prediction.The proposed method is implemented in the vertex pro II FPGA environment for analysing the input-output characteristics. FPGA is used in deep learning acceleration since it has the flexibility in deploying the architectures with huge parallelism that results in high execution speeds. Since it has high-performance interfaces to external memory, the design is easy to perform the comparison. SelectIO™-Ultra Technology is used in FPGA technology. The synthesis contains a gate count of 8758 gates, a clock frequency of 210 MHz (4.79 ns), and the input and output (IO) delay is 0.2 ns. Logic blocks (LB) in FPGAs are used for the implementation of common logic functions. Algorithmic optimizations in deep learning also can be adaptable in FPGAs.Table4 shows FPGA implementation results in terms of frequency lookup tables, arithmetic functions, buffers, and I/O devices. Figure 12 shows the relation between maximum throughput and the maximum frequency concerning bits per clock cycle (BPCC). High-performance design in hardware devices upholds the disadvantage of memory sharing between processors in any architecture. In the case of FPGAs, the memory can be used as an on-chip and programmable logic cells controlling the entire issue.Table 4
FPGA utilization results.
Parameters analyzedValuesFrequency870 MHzLookup tables (LUTs)6,672Multiplier blocks for arithmetic functions18 bit × 18 bitNo. of multiplexer buffers16Low-voltage differential signaling I/O840 Mb/sSink/source current per I/O2 mA to 24 mAFigure 12
Relation between maximum throughput frequency and BPCC.Figure13 states the analysis of the proposed method with parameters such as power (in µW), area (in terms of gate count), delay (ns), and power delay factor (PDF). The performance graph shows the improvement in the design and comparatively outperforms. Figure 13 shows the comparison chart for AlexNet and VGG16 in Arria 10 Environment. Figure 14 describes the comparison chart for AlexNet and VGG16 in Arria 10 FPGA Environment.Figure 13
Analysis of power, area, delay, and PDF.Figure 14
Comparison chart for AlexNet and VGG16 in Arria 10 environment.


## 7. Conclusion

COVID-19 made a remarkable situation in everyone’s life. It affects the human lungs; especially Lung damage is unpredictable, and many challenges are behind this to detect. High-performance detection systems are required for the analysis. The proposed method shows the detection of COVID-19 from the lung images using a deep learning-based algorithm. AI-based Flask-driven web application framework predicts the six different diseases including ARDS, bacteria, COVID-19, SARS, andStreptococcus, virus. The training and testing are done using algorithms such as CNN, ResNet (with and with-out dropout), VGG16, and AlexNet for the detection. Developing trial-time with high performance is an important constraint for the forthcoming research in FPGAs along with deep learning. The implementations of deep learning algorithms in FPGA accomplish some challenges such as specifications of the target device, optimization, and computational analysis of data. Throughput is achieved at 1.2 Gbins/sec at 700 frequency. The low power achieved for the design is 121 mW. The area of the design is also reasonably low when compared to the traditional designs. It attains an area of 2.5 mms. The delay of the design is 89 ms. Hence, the proposed design has much concentration on those specific frameworks of deep learning principles by FPGA. The proposed method is implemented in the target device with the ultratechnology environment to attain high performance.



---

*Source: 2110785-2022-06-28.xml*