Proposal Sample 1
Proposal Sample 1
Proposal Sample 1
INSTITUTE OF ENGINEERING
Khwopa College of Engineering
Libali, Bhaktapur
Department of Computer Engineering
A FINAL REPORT ON
DETECTING COVID-19 INDUCED PNEUMONIA
FROM CHEST X-RAYS
Submitted by
Prasanna Adhikari KCE074BCT029
Sangat Rokaya KCE074BCT039
Subin Timilsina KCE074BCT042
Sujan Acharya KCE074BCT043
................................
Er. Dinesh Ghemosu
(Project Supervisor)
...........................................................
Prof. Dr. Sashidhar Ram Joshi
(External Examiner)
Central Campus Pulchowk, Institute of Engineering
Lalitpur, Nepal
.........................................
Er. Shiva K. Shrestha
Head of Department
Department of Computer Engineering, KhCE
i
Copyright
The author has agreed that the library, Khwopa College of Engineering and
Management may make this report freely available for inspection. Moreover, the
author has agreed that permission for the extensive copying of this project report
for scholarly purpose may be granted by supervisor who supervised the project
work recorded herein or, in absence the Head of The Department wherein the
project report was done. It is understood that the recognition will be given to
the author of the report and to Department of Computer Engineering, KhCE in
any use of the material of this project report. Copying or publication or other use
of this report for financial gain without approval of the department and author’s
written permission is prohibited. Request for the permission to copy or to make
any other use of material in this report in whole or in part should be addressed
to:
Head of Department
Department of Computer Engineering
Khwopa College of Engineering(KhCE)
Liwali,
Bhaktapur, Nepal.
ii
Acknowledgement
We take this opportunity to express our deepest and sincere gratitude to our
supervisor Er. Dinesh Ghemosu, for his insightful advice, motivating suggestions,
invaluable guidance, help and support in successful completion of this project
and also for his constant encouragement and advice throughout our Bachelor’s
program. We are deeply indebted to our teachers Er. Shiva k. Shrestha, Er.Bindu
Bhandari for boosting our efforts and morale by their valuable advices and suggestion
regarding the project and supporting us in tackling various difficulties. Also,
we would like to thank Er. Ram Sapkota for providing valuable suggestions
and supporting the project. In Addition, we also want to express our gratitude
towards Er. Dinesh Man Gothe for providing the most important advice and
giving realization of the practical scenario of the project.
iii
Abstract
Exponential growth of COVID-19 has led to the serious damage across the globe
resulting in rapid use of expensive COVID-19 testing kits which are minimally
available. Those limited kits are not so able to provide the exact diagnosis timely.
So, we intended to the use Chest X-Rays and AI based automatic detection model
as a quick alternative diagnosis to prevent COVID-19 spreading among people
with the minimum cost.This project attempts to identify whether a person is
affected from the COVID-19 or Pneumonia through Chest X-Rays. In this work
we use Deep Learning techniques with deep CNN based models i.e. Dark-Net
model. After models are trained and validated, Grad-CAM is used for the proper
reasoning as it visualizes over the regions of the processed image according to the
weight, which are essentials for making the prediction more precise. Such result
obtained from that model can be accessed and monitored by the expert radiologist
that assist in further diagnosis process of the patient. Using the publicly available
datasets [5, 6], our model gives accuracy of 98.6 percent.
Keywords: Convolution Neural Network,Dark-Net, COVID-19, Neural Network,
Grad-CAM.
iv
Contents
Certificate of Approval . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
Copyright . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Acknowledgement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
List of Abbreviation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
1 Introduction 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Literature Review 3
3 Requirement Analysis 5
3.1 HARDWARE AND SOFTWARE REQUIREMENT . . . . . . . . 5
3.1.1 Hardware Requirements . . . . . . . . . . . . . . . . . . . . 5
3.1.2 Software Requirements . . . . . . . . . . . . . . . . . . . . . 5
3.2 FUNCTIONAL REQUIREMENT . . . . . . . . . . . . . . . . . . . 5
3.2.1 Classification . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2.2 Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.3 NON-FUNCTIONAL REQUIREMENT . . . . . . . . . . . . . . . 5
3.3.1 Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.3.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.3.3 Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.4 FEASIBILITY STUDY . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.4.1 Economic Feasibility . . . . . . . . . . . . . . . . . . . . . . 6
3.4.2 Technical Feasibility . . . . . . . . . . . . . . . . . . . . . . 6
3.4.3 Operational Feasibility . . . . . . . . . . . . . . . . . . . . . 6
4 Project Methodology 7
4.1 System Development Requirement . . . . . . . . . . . . . . . . . . . 7
4.2 Block Diagram of System . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 Description of Working Flow of System . . . . . . . . . . . . . . . 9
5 Implementation Plan 12
5.1 Cost Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6 Work Completed 13
6.1 Accumulation and Arrangement of Data set . . . . . . . . . . . . . 13
6.2 Creation of Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.3 Model Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.4 Visualization and Reasoning . . . . . . . . . . . . . . . . . . . . . . 16
v
7 Work in Progress 21
7.1 Visualization and Reasoning . . . . . . . . . . . . . . . . . . . . . . 21
7.2 Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
8 Conclusion 22
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
vi
List of Figures
4.1 Prototype Model for System Development . . . . . . . . . . . . . . 7
4.2 Block Diagram of our system . . . . . . . . . . . . . . . . . . . . . 8
4.3 Architecture of System (Dark-Net CNN) . . . . . . . . . . . . . . . 8
4.4 Block Diagram for generation of Saliency Map . . . . . . . . . . . 9
4.5 Diagram for Feature Extraction form CNN [1] . . . . . . . . . . . . 10
vii
List of Abbreviation
viii
Chapter 1
Introduction
1.1 Background
The 2019 novel coronavirus (COVID-19) pandemic initiated in Wuhan, China [9]
in December 2019 and has become a serious affair widely. The novel coronavirus
(COVID-19) has become the most pressing issue facing mankind. Like a wildfire
burning through the world, the COVID-19 disease has changed the global landscape
in only three months. A high reproduction rate and a higher chance of complications
has led to border closures, empty streets, rampant stockpiling, mass self-isolation
policies, an economic recession, and a cultural shift towards mistrust. This pandemic
has created a massive threat to all of us as death toll are still rising today in a
great extent worldwide. As per WHO with the increment of each second, a new
death case is reported. As of now (7 February 2021) [9], total cases that has
been reported is approximately 106,375,662, out of which 2,321,294 are dead and
78,021,392 are recuperated. COVID-19 has led to exceptional healthcare crisis
with millions of people are affected across the globe.
The current COVID-19 pandemic has placed a huge strain on healthcare systems,
with hospitals being overloaded, scarcity of testing kits, scarcity of infrastructure
for treatment, as well as lack of skilled manpower to operate them even in the
sophisticated countries. As per detail analysis fever, dry cough and tiredness
were found to be COVID-19 common symptoms but as it worsen severe acute
respiratory syndrome, chest pain, pneumonia, multi-organ failure were seen which
ultimately leads person to death. For the identification of trace of pneumonia,
Chest [9] X-rays are commonly used so that we supposed it would be an intriguing
challenge to determine viral, bacterial and COVID-19 pneumonia infections. Additionally,
it is also stated that CXRs screening for asymptomatic carries of COVID-19 may
aid as a viable substitute for the available RT – QPCR tests. The high infection
rate of the COVID-19 has resulted unprecedented burden on the healthcare and
shortage of the isolation wards. So in the shortage and delay in PCR tests, CXRs
can become one of the fastest and the most affordable ways for the doctors to
the triage (degree of urgency) patients. So, in order to withstand the pandemic
crisis Chest X-rays acts as an non-invasive tool to monitor the progression of the
disease as CXRs is a widespread, relatively cheap, fast, and accessible diagnostic
modality, which can be easily brought to the patient’s bed, even in the emergency
departments. This results in the support of those centers which are facing staff
shortage, overwhelming patient loads. Due to these sorts of problems we were
motivated to develop a system that can assist the health sectors in carrying the
testing process faster and with better efficiency.
With the help of various AI based systems and Deep learning techniques, we
can develop a model that automatically detects COVID-19 by using CXRs on
training a model using various data-sets obtained from the CXRs, using various
network model, to represent a cost beneficial solution for the early diagnosis of
1
infection and timely risk stratification with precision.Also for the addition of the
more transparency and to make the model more explanatory various reasoning
techniques are available among which Grad-CAM visualization techniques is used.
It uses the gradients of the target concept say ’X-Ray’ in classification network
flowing into the final convolution layer to produce a rough localization map contrasting
the affected regions of the processed X- Ray image for making the prediction.
1.3 Objective
The main objective of this project is :
• To detect COVID-19 induced Pneumonia from the Chest X-Rays and visualize
the affected regions.
2
Chapter 2
Literature Review
COVID-19 is a world-wide pandemic affecting more than 10 million people. Similarly,
due to its nature and recent outbreak it’s tracing requires time, money and
manpower. So many scientist and engineer were involved in developing a system
that could automatically detect the COVID-19 in those patients whose lungs were
affected. Some of the previously done task and activities are discussed below.
Ozturk Tulin et.al [1] have proposed a deep learning based model to detect
and classify COVID-19 cases from X-ray images. Their model is fully automated
with an end-to-end structure without the need for manual feature extraction. The
developed system is able to perform binary and multi-class tasks with an accuracy
of 98.08% and 87.02%, respectively but this activity was carried in very few input
images.
Elaziz Mohamed Abd et. al [2]the features extracted from the chest x-ray
images using new FrMEMs. A parallel multi-core computational framework utilized
to accelerate the computational process. Then, a modified Manta-Ray Foraging
Optimization based on differential evolution used to select the most significant
features. The proposed method evaluated using two COVID-19 x-ray datasets.
The proposed method achieved accuracy rates of 96.09% and 98.09%.
Asif Sohaib et. al [3]automatically detect COVID-19 pneumonia patients
using digital chest x-ray images while maximizing the accuracy in detection using
DCNN. The dataset consists of 864 COVID-19, 1345 viral pneumonia and 1341
normal chest x-ray images. In this study, DCNN based model with transfer
learning have been proposed for the detection of coronavirus pneumonia infected
patients using chest X-ray radiographs and classification accuracy of more than
98% (training accuracy of 97% and validation accuracy of 93%). The results
demonstrate that transfer learning proved to be effective, showed robust performance
and easily deployable approach for COVID-19 detection.
Encalada Angel et. al [4] pre-trained network to reduce training times and in a
first model obtained an accuracy of 90%. And by adjusting the learning rate they
were able to improve the model to 97%.The pre-trained network that was used
was the Resnet34 with SVM but they used very few images for the training model.
They used radiographs from people from other countries for testing their images
and could perform just enough on the practical cases. We cannot say whether or
not this affects the model because this requires further investigation and is not our
field. We leave this part to the health experts and we clarify that our intention
is to collaborate and combine their experience with this type of tool. To increase
the data-set, they used some transformations but a medical imaging expert might
recommend performing additional transformations and even prefer not to perform
the ones we use.
Mangal Arpan et. al [7] created a COVID-19 AI Detector based on novel
deep neural network for triaging patients for appropriate testing. On the publicly
available COIVD chest XRay data-set the model gave 90.5% accuracy with 100%
3
sensitivity for the COVID-19 infection and there was a significant improvement on
the results of Covid-Net on the same dataset.COVID-net uses a machine-driven
design exploration to learn the architecture design starting from initial design
prototype and requirements. It takes as input a chest X-Ray image and outputs
a prediction among three classes: Normal, Pneumonia and COVID-19.
We used the DarkNet model because the parameters in other models were
very high and difficult to work with. Similarly, the problem of overfitting were
seen much more prevalent in other models but with DarkNet this problem was
minimized to high extent and the number of parameters to work with were less so
the process was handled efficiently.
4
Chapter 3
Requirement Analysis
3.1 HARDWARE AND SOFTWARE REQUIREMENT
• Fast AI
• Google Colab
3.2.2 Visualization
System should be able to visualize the affected regions.
3.3.2 Performance
The performance of the system is fast, when image is uploaded then instantly
visualized image of chest X-Ray is obtained with the classification whether it is
Normal, COVID-19 or Pneumonia.
5
3.3.3 Portability
The project is portable as it is implemented on the web.
6
Chapter 4
Project Methodology
4.1 System Development Requirement
Prototype methodology is a system development model in which a prototype
is built, test and then reworked when needed until an acceptable prototype is
achieved. Prototype is also called as an dummy implementation where, dummy
model is designed with certain parameters and on the basis of the ouput rework
is done.
For the development of the our model we used the prototype model in which
a prototype is built first with the certain parameters then it is tested, if certain
limit of the accuracy is achieved then it is accepted as the final form otherwise, it
is reworked until acceptable accuracy is achieved. The prototype model is chosen
as our system has the limited functional requirements and also user requirements
are also fixed.
7
4.2 Block Diagram of System
For the development the system, firstly Chest X-rays is fed to the system and
model predicts and classifies whether it is COVID-19 or Pneumonia or Normal
and on the basis of the classification and the visualization algorithm the saliency
map is generated. Saliency maps aim to define where a particular region is different
from its neighbors with respect to image features.
Block Diagram of System is shown Figure 4.2
We used Dark-Net model whose system architecture is shown in Figure 4.3
Various entropy calculations are done for the generation of the sailency map
which is shown in Figure 4.4.
8
Figure 4.4: Block Diagram for generation of Saliency Map
9
We are expecting the DarkNet-19 model to be efficient for us that consists of
19 convolution layers and five pooling layers, using Max-pool. This model shall
be focused primarily in detecting COVID-19 positive or negative then shall be
enhanced for multi-class classifications.
C1-M1-C2-M2-C3-C4-C5-M3-C6-C7-C8-M4-C9-C10-C11-C12-C13-M5-C14-C15-
C16-C17-C18-C19
We are expecting a descent accuracy for the model with this network. As this
network has about 1 - 10 millions training parameters which is decent enough to
train a model without having over-fitting. Since this network focuses on capturing
and learning new small differences rather than going extra deep to find out the
features from the image. But we shall be focusing on improving the models
accuracy to the best value possible with hyper-parameter tuning and many other
fine tuning mechanisms. This can provide the output for us expected from an
X-Ray image.
Now we shall head on for reasoning part for our built model to demonstrate
why the model predicted such output. For this part of project we shall be using
Class Activation Maps or Saliency Maps with the help of Grad-CAM that can
show the part in the X-Ray that has been affected by virus or bacteria. This
can assist a medical professional to easily understand the X-Ray that can help
in accurate and faster surveillance of the patients. He/She can also be assisted
in predicting the severity of the patient’s lungs. The confidence of positive for
the image can help the image to be easily interpreted by the professionals. For
10
this we examine the current X-Ray frame by calculating entropy of every region
by inputting intensity, colour and orientation of the image. Then we map out
the intensity, color and orientation feature in the map showing the area that is
found to be affected.Here Grad-CAM assumes the final score Y c for a particular
class c can be written as a linear combination of its global average pooled last
convolutional layer feature maps Ak .
Where, wkc is the weight for the particular feature map Ak Each spatial location
(i ,j) in the class- specific saliency map Lc is then calculated as:
Here Lcij directly corresponds with the importance of a particular spatial location
(i,j) for a particular class c and functions as a visual explanation of the the class
predicted by the network. Weight for the particular feature map can be calculated
as the:
Here Z is the constant number of the pixel in the activation map and is obtained by
partial derivative of score Y c with respect to the activation map Ak . For obtaining
fine- grained pixel scale representation Guided Grad-CAM is used where class
specific saliency map Lc are unsampled and fused via point wise multiplication
with the visualizations generated by the Back-propagation.
Finally, when our objectives are fulfilled we shall then deploy this model into a
flask server or any other possible for us so that we do not have to train this model
again to use them and also assist in determination of condition of lungs to find
out whether it has been affected by the corona virus or any other bacteria or not.
11
Chapter 5
Implementation Plan
5.1 Cost Estimation
The main requirement of this project is the images of Chest X-Rays for training
and validating our model whose processing gives us the increased accuracy of the
project that we desire and much of the data is readily available on the internet
already so we can carry out the process easily. More the data-sets higher would be
the probability of gaining higher accuracy otherwise it might result in over-fitting
problems during the training process as number of training parameters will be
high in transfer learning process. Similarly, higher computational power is desired
for faster processing and training the huge amount of data. But the processing
ability we currently can access might be sufficient for our desired model building
process by using our local machine as well as some cloud based service for carrying
out the modelling process as well as for proper reasoning of the output provided.
The deployment of the given system might add some cost but we will be try to
make this system to be as cost efficient as possible.
So, the cost in our project is bare minimum but if we are going to increase the
scope of the project then cost can be managed according to the necessity.
12
Chapter 6
Work Completed
In the past duration of time we accomplished the following:
13
first described in a paper titled You Only Look Once: Unified, Real-Time Object
Detection [8]. The approach of YOLO involves a single deep convolutional neural
network (originally a version of GoogleNet, later updated and called DarkNet
based on VGG) that splits the input into a grid of cells and each cell directly
predicts a bounding box and object classification. The result is a large number
of candidates bounding boxes that are consolidated into a final prediction by a
post-processing step.
The Biggest advantages of YOLO model are:
• Speed (45 frames per second — better than real-time)
• faster version (with smaller architecture) — 155 frames per sec but is less
accurate.
This system has the state-of-the-art architecture designed for object detection.The
internal parameters are used that needs to be properly adjusted to accomplish our
task of classification.
Here we initially used small filters to extract tiny features. We are expecting
the DarkNet-19 model to be efficient for us as it consists of 19 convolution layers
and five pooling layers, using Max-Pool. This model shall be focused primarily
multi-class classifications.
First, we have trained the DarkNet deep learning model to classify and detect X-
ray images into three categories: COVID-19, Normal, Pneumonia. The performance
of the proposed model is evaluated using the 5-fold cross-validation procedure for
both the binary and triple classification problem. Eighty percent of X-ray images
are used for training and 20 percent for validation. The experiments are repeated
five times. All of the split k pieces are wrapped in folds to use in the validation
stage. We have trained DarkCovidNet for 100 epochs. There is significant increase
in loss values in the beginning of the training which decrease substantially in later
stages of the training which occurs due to the volume of data in the COVID-
19 class, which is much lower than in the other two classes (pneumonia and
undiagnosed data). However, this discrepancy in the model is slowly reduced
when the deep model examines all X-ray images over and over again for each
epoch during the training.
The Multi-class classification performance of the DarkNet model has been
evaluated for each fold, and the average classification performance of the model is
calculated. The overlapped CM is created using the sum of CMs obtained in all
folds. Thus, it is aimed to obtain an idea about the general perforations of the
model. The DarkNet model achieved an average classification accuracy of 99.02
percent to classify:COVID-19, Normal and Pneumonia.
The proposed model has 17 convolution layers. Each DarkNet layer has one
convolutional layer followed by BatchNorm, and LeakyReLU operations, while
each 3 Conv layer has the same setup three times in successive form. The batch
normalization operation is used to standardize the inputs, and this operation has
other benefits, such as reducing training time and increasing stability of the model.
LeakyReLU is a variation of the ReLU operation used to prevent dying neurons.
14
Unlike ReLU or sigmoid activation functions, which have zero value in the negative
part of their derivatives, LeakyReLU has a small epsilon value to overcome the
dying neuron problem. Similar to the Darknet-19 model, the Maxpool method
is used in all the pooling operations. Maxpool downsizes an input by taking the
maximum of a region determined by its filter. When working with three classes,
the proposed model performs the COVID-19 detection task. If three different
classes of images are used in the input, the same model performs the classification
task to determine the labels of the input chest X-ray images as COVID-19 or
Normal or Pneumonia. The developed deep learning model consists of 1,164,434
parameters.
F-score is the measure of the test accuracy which is calculated with the help of
the precision and the recall of the test, where precision is the number of correctly
identified true results divided by total number of all true results including those
not identified true and recall is the number of correctly identified true results
divided by the number of samples that should have been identified as true.
f1 is the harmonic mean of the precision and recall and is calculated as:
15
the model predicted a positive value, True negative:he actual value was negative
and the model predicted a negative value, False positive: he actual value was
negative but the model predicted a positive value and False negative: he actual
value was positive but the model predicted a negative value. In TP and TN
predicted values matches the actual values and in FP and FN predicted values
doesn’t matches the actual values.
We can calculate Accuracy, Precision and Recall from the confusion matrix easily
by using:
Accuracy = (T P + T N )/(T P + F P + T N + F N )
P recision = (T P )/(T P + F P )
Recall = (T P )/(T P + F N )
In the confusion matrix shown in figure 6.5: 85 COVID, 88 Normal and 86
Pneumonia were correctly classified by the model.
16
Figure 6.1: First part of accuracy traced
17
Figure 6.2: Second part of accuracy traced
18
Figure 6.4: F-score calculation
19
Figure 6.6: Visualization for COVID
20
Chapter 7
Work in Progress
7.1 Visualization and Reasoning
Although we are known with the concept but we are having difficulties in the
implementation of the Grad-CAM techniques for the localization. We are in touch
with our HOD Er. Shiva k. Shrestha sir and also we are involving in the various
Youtube sessions and also we have been reading various research papers regarding
Grad-CAM implementation.
7.2 Deployment
We also have been working for the deployment of the system into a flask server
so that we don’t have to train model again and again to use them. Also as
per Dr.Jhanak Parajuli sir, we are also facilitated with the Heroku(cloud based
platform for building and executing application). As per the difficulty we shall
choose one among them.
21
Chapter 8
Conclusion
Almost 75 percent of task is completed and our team members have been working
on the various implementation techniques of Grad-CAM and deployment for the
system representation.
Predicted
Pneumonia
COVID
Normal
COVID 85 0 1
Actual
Normal 0 88 0
Pneumonia 0 3 83
22
Bibliography
[1] Tulin et al. 1. Ozturk. Automated detection of covid-19 cases using deep
neural networks with x-ray images. Computers in biology and medicine vol.
121 (2020): 103792., 2020.
[2] Salah A Darwish MM Lu S Sahlol AT. 2. Elaziz MA, Hosny KM. New
machine learning method for image-based diagnosis of covid-19. In PLoS One.
2020;15(6):e0235187, pages 1–4. PONE, 2020.
[3] Sohaib Asif, Yi Wenhui, Hou Jin, Yi Tao, and Si Jinhai. Classification of
covid-19 from chest x-ray images using deep convolutional neural networks.
medRxiv, 2020.
[4] Andres Torres Christian Tutiven Galvez, Angel Enclada. Covid-19 detector
using xrays. 2020.
[7] Arpan Mangal, Surya Kalia, Harish Rajgopal, Krithika Rangarajan, Vinay
Namboodiri, Subhashis Banerjee, and Chetan Arora. Covidaid: Covid-19
detection using chest x-ray, 2020.
[8] Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. You only
look once: Unified, real-time object detection, 2016.
23