You are on page 1of 44

COVID-19 DETECTION WITH X-RAY AND CT-SCAN USING

MACHINE LEARNING
ABSTRACT

We researched the diagnostic capabilities of deep learning on chest radiographs and an


image classifier based on the COVID-Net was presented to classify chest MRI images. In
the case of a small amount of COVID-19 data, data enhancement was proposed to expanded
COVID-19 data 17 times. Our model aims at transfer learning, model integration and
classify chest MRI images according to three labels: normal, COVID-19 and viral
pneumonia. According to the accuracy and loss value, choose the models ResNet-101 and
ResNet-152 with good effect for fusion, and dynamically improve their weight ratio during
the training process.
After training, the model can achieve 96.1% of the types of chest MRI images
accuracy on the test set. This technology has higher sensitivity than radiologists in the
screening and diagnosis of lung nodules. As an auxiliary diagnostic technology, it can help
radiologists improve work efficiency and diagnostic accuracy.
COVID-19 is posed as very infectious and deadly pneumonia type disease until recent
time. Despite having lengthy testing time, RT-PCR is a proven testing methodology to detect
coronavirus infection. Sometimes, it might give more false positive and false negative results
than the desired rates. Therefore, to assist the traditional RT-PCR methodology for accurate
clinical diagnosis, COVID-19 screening can be adopted with X-Ray and CT scan images of
lung of an individual. This image based diagnosis will bring radical change in detecting
coronavirus infection in the human body with ease and having zero or near to zero false
positives and false negatives rates. This paper reports a convolutional neural network (CNN)
based multi-image augmentation technique for detecting COVID-19 in chest X-Ray and chest
CT scan images of coronavirus suspected individuals. Multi-image augmentation makes use
of discontinuity information obtained in the filtered images for increasing the number of
effective examples for training the CNN model. With this approach, the proposed model
exhibits higher classification accuracy around 95.38% and 98.97% for CT scan and X-Ray
images respectively. CT scan images with multi-image augmentation achieves sensitivity of
94.78% and specificity of 95.98%, whereas X-Ray images with multi-image augmentation
achieves sensitivity of 99.07% and specificity of 98.88%. Evaluation has been done on
publicly available databases containing both chest X-Ray and CT scan images and the
experimental results are also compared with ResNet-50 and VGG-16 models.
ACKNOWLEDGEMENT

I offer my gratitude to the Lord Almighty who graced me and helped me all along to
complete the project successfully. To the Lord’s glory I supplicate this work.

I owe my sincere thanks to Dr. M. Arularasu, M.E., Ph.D., Principal, TPGIT for
taking a keen interest in the project and for guiding throughout the work even under his busy
schedule.

I owe my sincere thanks to Dr. J. Sreerambabu Ph.D., PDF.,Vice Principal and


Head of the Department, Master of Computer Applications for taking a keen interest in the
project and for guiding throughout the work even under his busy schedule and motivation to
complete this project.

I also express my sincere thanks to Mr. M. Mohammed Riyaz, MCA., Assistant


Professor and Project Coordinator, Department of Master of Computer Applications for his
valuable guidance and motivation to complete this project. His efforts to bring out the best in
me, his availability at all times and thought providing questions and timely suggestions.

I also very thankful to Mr. N. Santhosh, MCA., Assistant Professor and Project
Supervisor, Department of Master of Computer Applications for his valuable guidance and
motivation to complete this project and his efforts to bring out the best in me, his availability
at all times and thought providing questions and timely suggestions.

I am also very thankful to Mr. S. Kalidasan, MCA, Assistant Professor, Faculty in-
charge Department of MCA, I am greatly benefited by the invaluable guidance and
coordination of his efforts to bring out the best in me.

I also express my thanks to all the staff members of the Department of MCA., TPGIT
for their constant support and encouragement. I also express my thanks to all the non-teaching
staff members for their support.
TABLE OF CONTENTS

CHAPTE TITL PAG


R E E
NO
i
ABSTRACT(ENGLISH)
ii
ABSTRACT(TAMIL)
iii
ACKNOWLEDGEMENT
vi
LIST OF FIGURES

1 INTRODUCTION 1

2 SYSTEM ANALYSIS

2.1 EXISTING SYSTEM 2

2.2 PROPOSED SYSTEM 3

3 DEVELOPMENT ENVIRONMENT

3.1 HARDWARE REQUIREMENTS 4

3.2 SOFTWARE REQUIREMENTS 4

3.3 SOFTWARE REQUIREMENT SPECIFICATIONS 4

4 SYSTEM DESIGN

4.1 ARCHITECTURE DIAGRAM 20

4.2 UML DIAGRAMS 21

4.2.1 USE CASE DIAGRAM 21

4.2.2 SEQUENCE DIAGRAM 22

5 MODULE DESCRIPTION

5.1 MODULES 23
6 SYSTEM IMPLEMENTATION

6.1 CODING 27
7 SYSTEM TESTING

7.1 UNIT TESTING 54

7.2 INTEGRATION TESTING 54

7.3 SYSTEM TESTING 54

7.4 USER MANUAL 55

8 APPENDICES

8.1 SCREENSHOTS 56

9 CONCLUSION AND FUTURE ENHANCEMENT

9.1 CONCLUSION 61

9.2 FUTURE ENHANCEMENT 61

REFERENCES 62
LIST OF FIGURES

FIGURE NAM PAGE


NO E NO

4.1 ARCHITECTURE DIAGRAM 20

4.2.1 USE CASE DIAGRAM 21

4.2.2 SEQUENCE DIAGRAM 22

7.1 EXTERNAL WORKINGS 54


CHAPTER 1

INTRODUCTION

The global spread of the COVID-19 pandemic has caused significant losses. The most
critical issues medical and healthcare departments are facing is the fact that the COVID19
was discovered promptly. Therefore, it is of great importance to check the diagnosis of the
suspected case, not only to facilitate the next step for the patients, but also to reduce the
number of infected people. MRI examination is considered to be the most commonly used
MRI examination method because of its low cost, wide range of application, and fast speed.
It plays a pivotal role in COVID-19 patient screening and disease detection. Because
COVID-19 attacks human respiratory epithelial cells, we can use MRI to detect the health
of the patient's lungs. How to detect these features from MRI has become a top priority.
The deep convolutional neural network has achieved unprecedented development in
image recognition, especially in the field of auxiliary medical diagnosis technology. Neural
networks have been successfully used in identifying pneumonia from MRI achieving
performances better than those of radiologists.
The main objective of using deep learning models is to achieve higher accuracy of
classification with chest X-Ray and CT scan images by separating the COVID-19 cases
from non-COVID-19 cases. The databases of X-Ray and CT scan images are publicly
available in GitHub repository for the purpose of experiments. Both these datasets contain
chest images of COVID-19 and non-COVID-19 individuals. The X-Ray database contains
67 COVID images and the same number of non-COVID images whereas CT scan database
contains 345 COVID images and the same number of non-COVID images. To conduct the
experiment, images are down-sampled to 50×50 dimensions from their original size. The
random subsampling or holdout method is adopted to test the efficacy of the model.
Moreover, this result exhibits more consistency while layers are being changed in CNN
based deep models. To evaluate the framework in a robust and effective way, a number of
evaluation metrics such as classification accuracy, loss, area under ROC curve (AUC),
precision, recall, F1 score and confusion matrix has been used. The values of these metrics
have been determined on different ratios of training and test samples considering a number
of layers in a deep model. The model is correctly able to classify the chest X-Ray and CT
scan images of COVID-19 cases from non-COVID-19 cases.
CHAPTER 2

SYSTEM ANALYSIS

2.1 EXISTING SYSTEM

The radiologist check the mri and write the reports and recommend to the doctor,
sometimes the appointment of radiologist will cost time and the delay of reports will occur
because it is done by the human, sometime human error will occur while writing a report
and the delay of report might be a big problem in emergency situation. And the cost of a
radiologist is also high sometimes if the tests are very intensive and it might cost much
higher.

DISADVANTAGES OF EXISTING SYSTEM

• Need a Proper radiologist to suggest the MRI result.


• Sometimes if the radiologist is not available then the delay of the report can occur
and it can lead to some serious problems for the patient.
• The hospital has to physical has the radiologist present always his salary can
impact the cost of treatment
2.2 PROPOSED SYSTEM

Chest MRI images as the research object. However, radiologists and experts mainly
interpret images based on personal clinical experience when analysing MRI images.
Usually, different doctors or experts have a different understanding of the same image.
Moreover, the situation of the same image in different periods is not entirely consistent, and
the conclusions produced will be different. Also, the workload of interpretation of images is
vast, and doctors are prone to misdiagnosis due to fatigue. Therefore, there is an urgent need
for a computer- aided diagnosis system to help radiologists interpret images faster and more
accurately.We use the method of automatically extracting features from deep convolutional
neural networks. This method does not require traditional manual methods for feature
extraction, avoiding complex feature extraction processes.

ADVANTAGES OF PROPOSED SYSTEM

• There is no need for a radiologist in the hospital.

• As we are using a ML Agent there is no need for a radiologist.

• Cost and salary of the radiologist will be saved.

• Efficient and accurate data will be given as the output.

• Small clinics can also benefit from this.


CHAPTER 3
SYSTEM REQUIREMENTS

3.1 HARDWARE REQUIREMENTS

RAM : 8 GB Ram
Processor : Intel i5 Processor or More
Hard Disk : 512 GB
GPU : 2 GB
Hard Disk : 20 GB
Floppy Drive : 1.44 MB
Key Board : Standard Windows Keyboard
Mouse : Two or Three Button Mouse
Monitor : SVGA

3.2 SOFTWARE REQUIREMENTS

Platform : ANACONDA NAVIGATOR

Editor Used : JUPYTER NOTEBOOK


WITH PYTHON IDLE

Operating System : Windows 10

Data Set : CSV

Framework : Tensorflow, scikit-learn

Cloud Platform : Google Cloud

3.3 SOFTWARE REQUIREMENTS SPECIFICATIONS

Flask Framework

Flask is a micro web framework written in Python. It is classified as a


microframework because it does not require particular tools or libraries.[2] It has no
database abstraction layer, form validation, or any other components where pre-existing
third-party libraries provide common functions. However, Flask supports extensions that
can
add application features as if they were implemented in Flask itself. Extensions exist for
object-relational mappers, form validation, upload handling, various open authentication
technologies and several common framework related tools.

Applications that use the Flask framework include Pinterest and LinkedIn.

TensorFlow
TensorFlow is Google Brain's second-generation system. Version 1.0.0 was released
on February 11, 2017.While the reference implementation runs on single devices,
TensorFlow can run on multiple CPUs and GPUs (with optional CUDA and SYCL
extensions for general-purpose computing on graphics processing units).[15] TensorFlow is
available on 64-bit Linux, macOS, Windows, and mobile computing platforms including
Android and iOS.
Its flexible architecture allows for the easy deployment of computation across a
variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters of servers to
mobile and edge devices.
TensorFlow computations are expressed as stateful dataflow graphs. The name
TensorFlow derives from the operations that such neural networks perform on
multidimensional data arrays, which are referred to as tensors. During the Google I/O
Conference in June 2016, Jeff Dean stated that 1,500 repositories on GitHub mentioned
TensorFlow, of which only 5 were from Google.[16]
In December 2017, developers from Google, Cisco, RedHat, CoreOS, and CaiCloud
introduced Kube Flow at a conference. Kubeflow allows operation and deployment of
TensorFlow on Kubernetes.
In March 2018, Google announced TensorFlow.js version 1.0 for machine learning in
JavaScript.
In Jan 2019, Google announced TensorFlow 2.0. It became officially available in Sep
2019.

In May 2019, Google announced TensorFlow Graphics for deep learning in computer
graphics.
Tensor processing unit (TPU)

Using or running models rather than training them. Google announced they had been
running TPUs inside their data centres for more than a year, and had found them to deliver
an order of magnitude better-optimised performance per watt for machine learning.

In May 2017, Google announced In May 2016, Google announced its Tensor
processing unit (TPU), an application-specific integrated circuit (ASIC, a hardware chip)
built specifically for machine learning and tailored for TensorFlow. A TPU is a
programmable AI accelerator designed to provide high throughput of low-precision
arithmetic (e.g., 8-bit), and oriented toward the second-generation, as well as the availability
of the TPUs in Google Compute Engine. The second-generation TPUs deliver up to 180
teraflops of performance, and when organised into clusters of 64 TPUs, provide up to 11.5
petaflops.

In May 2018, Google announced the third-generation TPUs delivering up to 420


teraflops of performance and 128 GB high bandwidth memory (HBM). Cloud TPU v3 Pods
offer 100+ petaflops of performance and 32 TB HBM.

In February 2018, Google announced that they were making TPUs available in beta
on the Google Cloud Platform.

TensorFlow Lite

In May 2017, Google announced a software stack specifically for mobile


development, TensorFlow Lite. In January 2019, TensorFlow team released a developer
preview of the mobile GPU inference engine with OpenGL ES 3.1 Compute Shaders on
Android devices and Metal Compute Shaders on iOS devices.In May 2019, Google
announced that their TensorFlow Lite Micro (also known as TensorFlow Lite for
Microcontrollers) and ARM's uTensor would be merging.
TensorFlow Lite uses FlatBuffers as the data serialisation format for network models,
eschewing the Protocol Buffers format used by standard TensorFlow models.
Applications

Google officially released RankBrain on October 26, 2015, backed by TensorFlow.


Google also released Colaboratory, which is a TensorFlow Jupyter notebook environment
that requires no setup to use.

Keras

Keras is an open-source software library that provides a Python interface for artificial
neural networks. Keras acts as an interface for the TensorFlow library.Up until version 2.3
Keras supported multiple backends, including TensorFlow, Microsoft Cognitive Toolkit,
Theano, and PlaidML.As of version 2.4, only TensorFlow is supported. Designed to enable
fast experimentation with deep neural networks, it focuses on being user-friendly, modular,
and extensible. It was developed as part of the research effort of project ONEIROS (Open-
ended Neuro-Electronic Intelligent Robot Operating System),and its primary author and
maintainer is François Chollet Google engineer. Chollet also is the author of the EXCeption
deep neural network model.

Python

Python is an interpreted, high-level and general-purpose programming language.


Python's design philosophy emphasises code readability with its notable use of significant
indentation. Its language constructs and object-oriented approach aim to help programmers
write clear, logical code for small and large-scale projects.

Python is dynamically-typed and garbage-collected. It supports multiple programming


paradigms, including structured (particularly, procedural), object- oriented and functional
programming. Python is often described as a "batteries included" language due to its
comprehensive standard library.

Guido van Rossum began working on Python in the late 1980's, as a successor to the
ABC programming language, and first released it in 1991 as Python 0.9.0.Python 2.0 was
released in 2000 and introduced new features, such as list comprehensions and a garbage
collection system using reference counting and was discontinued with version 2.7.18 in
2020. Python 3.0 was released in 2008 and was a major revision of the language that is not
completely backward- compatible and much Python 2 code does not run unmodified on
Python 3.

Python consistently ranks as one of the most popular programming languages.

History of Python

Python was conceived in the late 1980s by Guido van Rossum at Centrum Wiskunde
& Informatica (CWI) in the Netherlands as a successor to ABC programming language,
which was inspired by SETL, capable of exception handling and interfacing with the Amoeba
operating system. Its implementation began in December 1989.Van Rossum shouldered sole
responsibility for the project, as the lead developer, until 12 July 2018, when he announced
his "permanent vacation" from his responsibilities as Python's Benevolent Dictator For Life, a
title the Python community bestowed upon him to reflect his long-term commitment as the
project's chief decision-maker. He now shares his leadership as a member of a five-person
steering council. In January 2019, active Python core developers elected Brett Cannon, Nick
Coghlan, Barry Warsaw, Carol Willing and Van Rossum to a five-member "Steering
Council" to lead the project. Guido van Rossum has since then withdrawn his nomination for
the 2020 Steering council.
Python 2.0 was released on 16 October 2000 with many major new features, including
a cycle-detecting garbage collector and support for Unicode.
Python 3.0 was released on 3 December 2008. It was a major revision of the language
that is not completely backward-compatible. Many of its major features were backported to
Python 2.6.xand 2.7.x version series. Releases of Python 3 include the 2to3 utility, which
automates (at least partially) the translation of Python 2 code to Python 3.
Python's statements include (among others):
The assignment statement, using a single equals sign =.

The if statement, which conditionally executes a block of code, along with else and
elif (a contraction of else-if).The for statement, which iterates over an iterable object,
capturing each element to a local variable for use by the attached block.The while statement,
which executes a block of code as long as its condition is true.The try statement, which
allows exceptions raised in its attached code block to be caught and handled by
except clauses; it also ensures that clean-up code in a finally block will always be run
regardless of how the block exits.

The raise statement, used to raise a specified exception or re-raise a caught


exception.The class statement, which executes a block of code and attaches its local
namespace to a class, for use in object-oriented programming.The def statement, which
defines a function or method.
The with statement, from Python 2.5 released in September 2006,[79] which encloses
a code block within a context manager (for example, acquiring a lock before the block of
code is run and releasing the lock afterwards, or opening a file and then closing it), allowing
resource-acquisition-is-initialization (RAII)-like behaviour and replaces a common try/finally
idiom.[80]
The break statement exits from a loop.

The continue statement skips this iteration and continues with the next item.

The del statement removes a variable, which means the reference from the name to
the value is deleted and trying to use that variable will cause an error. A deleted variable can
be reassigned.
The pass statement, which serves as a NOP. It is syntactically needed to create an
empty code block.
The assert statement, used during debugging to check for conditions that should
apply.
The yield statement, which returns a value from a generator function. From Python
2.5, yield is also an operator. This form is used to implement coroutines.
The return statement, used to return a value from a function.

The import statement, which is used to import modules whose functions or variables
can be used in the current program. There are three ways of using import: import <module
name> [as <alias>] or from <module name> import * or from <module name> import
<definition 1> [as <alias 1>], <definition 2> [as <alias 2>], ....

The assignment statement (=) operates by binding a name as a reference to a separate,


dynamically-allocated object. Variables may be subsequently rebound at any time to any
object. In Python, a variable name is a generic reference holder and doesn't have a fixed data
type associated with it. However at a given time, a variable will refer to some object, which
will have a type. This is referred to as dynamic typing and is contrasted with statically-typed
programming languages, where each variable may only contain values of a certain type.

Python does not support tail call optimization or first-class continuations, and,
according to Guido van Rossum, it never will. However, better support for coroutine-like
functionality is provided in 2.5, by extending Python's generators.Before 2.5, generators were
lazy iterators; information was passed unidirectionally out of the generator. From Python 2.5,
it is possible to pass information back into a generator function, and from Python 3.3, the
information can be passed through multiple stack levels.

Machine Learning

Machine learning (ML) is the study of computer algorithms that improve


automatically through experience and by the use of data. It is seen as a part of artificial
intelligence. Machine learning algorithms build a model based on sample data, known as
"training data", in order to make predictions or decisions without being explicitly
programmed to do so. Machine learning algorithms are used in a wide variety of applications,
such as email filtering and computer vision, where it is difficult or unfeasible to develop
conventional algorithms to perform the needed tasks.
A subset of machine learning is closely related to computational statistics, which
focuses on making predictions using computers; but not all machine learning is statistical
learning. The study of mathematical optimization delivers methods, theory and application
domains to the field of machine learning. Data mining is a related field of study, focusing on
exploratory data analysis through unsupervised learning. In its application across business
problems, machine learning is also referred to as predictive analytics.

Overview of Machine Learning

Machine learning involves computers discovering how they can perform tasks without
being explicitly programmed to do so. It involves computers learning from data provided so
that they carry out certain tasks. For simple tasks assigned to computers, it is possible to
program algorithms telling the machine how to execute all steps required to solve the
problem at hand; on the computer's part, no learning is needed. For more advanced tasks, it
can be challenging for a human to manually create the needed algorithms. In practice, it can
turn out to be more effective to help the machine develop its own algorithm, rather than
having human programmers specify every needed step.

The discipline of machine learning employs various approaches to teach computers to


accomplish tasks where no fully satisfactory algorithm is available. In cases where vast
numbers of potential answers exist, one approach is to label some of the correct answers as
valid. This can then be used as training data for the computer to improve the algorithm(s) it
uses to determine correct answers. For example, to train a system for the task of digital
character recognition, the MNIST dataset of handwritten digits has often been used.

Artificial intelligence

Part of Machine Learning as subfield of AI or part of AI as subfield of Machine


Learning
As a scientific endeavour, machine learning grew out of the quest for artificial
intelligence. In the early days of AI as an academic discipline, some researchers were
interested in having machines learn from data. They attempted to approach the problem with
various symbolic methods, as well as what was then termed "neural networks"; these were
mostly perceptrons and other models that were later found to be reinventions of the
generalised linear models of statistics.Probabilistic reasoning was also employed, especially
in automated medical diagnosis.
However, an increasing emphasis on the logical, knowledge-based approach caused a
rift between AI and machine learning. Probabilistic systems were plagued by theoretical and
practical problems of data acquisition and representation.By 1980, expert systems had come
to dominate AI, and statistics was out of favor.[20] Work on symbolic/knowledge-based
learning did continue within AI, leading to inductive logic programming, but the more
statistical line of research was now outside the field of AI proper, in pattern recognition and
information retrieval. Neural networks research had been abandoned by AI and computer
science around the same time. This line, too, was continued outside the AI/CS field, as
"connectionism", by researchers from other disciplines including Hopfield, Rumelhart and
Hinton. Their main success came in the mid-1980s with the reinvention of backpropagation.
Machine learning (ML), reorganised as a separate field, started to flourish in the
1990s. The field changed its goal from achieving artificial intelligence to tackling solvable
problems of a practical nature. It shifted focus away from the symbolic approaches it had
inherited from AI, and toward methods and models borrowed from statistics and probability
theory.
As of 2020, many sources continue to assert that machine learning remains a subfield
of AI. The main disagreement is whether all of ML is part of AI, as this would mean that
anyone using ML could claim they are using AI. Others have the view that not all of ML is
part of ANYwhere only an 'intelligent' subset of ML is part of AI.
The question of what is the difference between ML and AI is answered by Judea Pearl
in The Book of Why. Accordingly ML learns and predicts based on passive observations,
whereas AI implies an agent interacting with the environment to learn and take actions that
maximise its chance of successfully achieving its goals.

Types of learning algorithms

The types of machine learning algorithms differ in their approach, the type of data
they input and output, and the type of task or problem that they are intended to solve.

Supervised learning
A support-vector machine is a supervised learning model that divides the data into
regions separated by a linear boundary. Here, the linear boundary divides the black circles
from the white.
Supervised learning algorithms build a mathematical model of a set of data that
contains both the inputs and the desired outputs.[38] The data is known as training data, and
consists of a set of training examples. Each training example has one or more inputs and the
desired output, also known as a supervisory signal. In the mathematical model, each training
example is represented by an array or vector, sometimes called a feature vector, and the
training data is represented by a matrix.
Through iterative optimization of an objective function, supervised learning
algorithms learn a function that can be used to predict the output associated with new inputs.
An optimal function will allow the algorithm to correctly determine the output for inputs that
were not a part of the training data. An algorithm that improves the accuracy of its outputs or
predictions over time is said to have learned to perform that task.
Types of supervised learning algorithms include active learning, classification and
regression. Classification algorithms are used when the outputs are restricted to a limited set
of values, and regression algorithms are used when the outputs may have any numerical value
within a range. As an example, for a classification algorithm that filters emails, the input
would be an incoming email, and the output would be the name of the folder in which to file
the email.
Similarity learning is an area of supervised machine learning closely related to
regression and classification, but the goal is to learn from examples using a similarity
function that measures how similar or related two objects are. It has applications in ranking,
recommendation systems, visual identity tracking, face verification, and speaker verification.

Self learning

Self-learning as a machine learning paradigm was introduced in 1982 along with a


neural network capable of self-learning named crossbar adaptive array (CAA).It is a
learning with no external rewards and no external teacher advice. The CAA self-learning
algorithm computes, in a crossbar fashion, both decisions about actions and emotions
(feelings) about consequence situations. The system is driven by the interaction between
cognition and emotion.The self-learning algorithm updates a memory matrix W =||w(a,s)||
such that in each iteration executes the following machine learning routine.

Models

Performing machine learning involves creating a model, which is trained on some


training data and then can process additional data to make predictions. Various types of
models have been used and researched for machine learning systems.
Artificial neural networks

An artificial neural network is an interconnected group of nodes, akin to the vast


network of neurons in a brain. Here, each circular node represents an artificial neuron and an
arrow represents a connection from the output of one artificial neuron to the input of another.
Artificial neural networks (ANNs), or connectionist systems, are computing systems vaguely
inspired by the biological neural networks that constitute animal brains. Such systems "learn"
to perform tasks by considering examples, generally without being programmed with any
task-specific rules.
An ANN is a model based on a collection of connected units or nodes called "artificial
neurons", which loosely model the neurons in a biological brain. Each connection, like the
synapses in a biological brain, can transmit information, a "signal", from one artificial neuron
to another. An artificial neuron that receives a signal can process it and then signal additional
artificial neurons connected to it. In common ANN implementations, the signal at a
connection between artificial neurons is a real number, and the output of each artificial
neuron is computed by some non-linear function of the sum of its inputs. The connections
between artificial neurons are called "edges". Artificial neurons and edges typically have a
weight that adjusts as learning proceeds. The weight increases or decreases the strength of the
signal at a connection. Artificial neurons may have a threshold such that the signal is only
sent if the aggregate signal crosses that threshold. Typically, artificial neurons are aggregated
into layers. Different layers may perform different kinds of transformations on their inputs.
Signals travel from the first layer (the input layer) to the last layer (the output layer), possibly
after traversing the layers multiple times.
The original goal of the ANN approach was to solve problems in the same way that a
human brain would. However, over time, attention moved to performing specific tasks,
leading to deviations from biology. Artificial neural networks have been used on a variety of
tasks, including computer vision, speech recognition, machine translation, social network
filtering, playing board and video games and medical diagnosis.
Deep learning consists of multiple hidden layers in an artificial neural network. This
approach tries to model the way the human brain processes light and sound into vision and
hearing. Some successful applications of deep learning are computer vision and speech
recognition.
Decision trees

Decision tree learning uses a decision tree as a predictive model to go from


observations about an item (represented in the branches) to conclusions about the item's
target value (represented in the leaves). It is one of the predictive modelling approaches
used in statistics, data mining, and machine learning. Tree models where the target variable
can take a discrete set of values are called classification trees; in these tree structures, leaves
represent class labels and branches represent conjunctions of features that lead to those class
labels. Decision trees where the target variable can take continuous values (typically real
numbers) are called regression trees. In decision analysis, a decision tree can be used to
visually and explicitly represent decisions and decision making. In data mining, a decision
tree describes data, but the resulting classification tree can be an input for decision making.

Training models

Usually, machine learning models require a lot of data in order for them to perform
well. Usually, when training a machine learning model, one needs to collect a large,
representative sample of data from a training set. Data from the training set can be as varied
as a corpus of text, a collection of images, and data collected from individual users of a
service. Overfitting is something to watch out for when training a machine learning model.
Trained models derived from biassed data can result in skewed or undesired predictions.
Algorithmic bias is a potential result from data not fully prepared for training.

RestNet

A residual neural network (ResNet) is an artificial neural network (ANN) of a kind


that builds on constructs known from pyramidal cells in the cerebral cortex. Residual neural
networks do this by utilising skip connections, or shortcuts to jump over some layers. Typical
ResNet models are implemented with double- or triple- layer skips that contain nonlinearities
(ReLU) and batch normalisation in between.An additional weight matrix may be used to
learn the skip weights; these models are known as HighwayNets. Models with several parallel
skips are referred to as DenseNets.In the context of residual neural networks, a non-residual
network may be described as a plain network.
A reconstruction of a pyramidal cell. Soma and dendrites are labelled in red, axon
arbour in blue. (1) Soma, (2) Basal dendrite, (3) Apical dendrite, (4) Axon, (5) Collateral
axon. One motivation for skipping over layers is to avoid the problem of vanishing gradients,
by reusing activations from a previous layer until the adjacent layer learns its weights. During
training, the weights adapt to mute the upstream layer[clarification needed], and amplify the
previously-skipped layer. In the simplest case, only the weights for the adjacent layer's
connection are adapted, with no explicit weights for the upstream layer. This works best
when a single nonlinear layer is stepped over, or when the intermediate layers are all linear. If
not, then an explicit weight matrix should be learned for the skipped connection (a
HighwayNet should be used).
Skipping effectively simplifies the network, using fewer layers in the initial training
stages[clarification needed]. This speeds learning by reducing the impact of vanishing
gradients, as there are fewer layers to propagate through. The network then gradually restores
the skipped layers as it learns the feature space. Towards the end of training, when all layers
are expanded, it stays closer to the manifold[clarification needed] and thus learns faster. A
neural network without residual parts explores more of the feature space. This makes it more
vulnerable to perturbations that cause it to leave the manifold, and necessitates extra training
data to recover.

SCIKIT
Scikit-learn (formerly scikits.learn and also known as sklearn) is a free software
machine learning library for the Python programming language.[3] It features various
classification, regression and clustering algorithms including support vector machines,
random forests, gradient boosting, k-means and DBSCAN, and is designed to interoperate
with the Python numerical and scientific libraries NumPy and SciPy.

Overview of SCIKIT
The scikit-learn project started as scikits.learn, a Google Summer of Code project by
David Cournapeau. Its name stems from the notion that it is a "SciKit" (SciPy Toolkit), a
separately-developed and distributed third-party extension to SciPy.[4] The original codebase
was later rewritten by other developers. In 2010 Fabian Pedregosa, Gael Varoquaux,
Alexandre Gramfort and Vincent Michel, all from the French Institute for Research in
Computer Science and Automation in Rocquencourt, France, took leadership of the project
and made the first public release on February the 1st 2010.[5] Of the various scikits, scikit-
learn as well as scikit-image were described as "well-maintained and popular" in November
2012.Scikit-learn is one of the most popular machine learning libraries on GitHub.

Implementation
Scikit-learn is largely written in Python, and uses numpy extensively for high-
performance linear algebra and array operations. Furthermore, some core algorithms are
written in Cython to improve performance. Support vector machines are implemented by a
Cython wrapper around LIBSVM; logistic regression and linear support vector machines by a
similar wrapper around LIBLINEAR. In such cases, extending these methods with Python
may not be possible.
Scikit-learn integrates well with many other Python libraries, such as matplotlib and
plotly for plotting, numpy for array vectorization, pandas dataframes, scipy, and many more.

Epochs, Batch Size, & Iterations


In most cases, it is not possible to feed all the training data into an algorithm in one
pass. This is due to the size of the dataset and memory limitations of the compute instance
used for training. There is some terminology required to better understand how data is best
broken into smaller pieces.

An epoch elapses when an entire dataset is passed forward and backward through the
neural network exactly one time. If the entire dataset cannot be passed into the algorithm at
once, it must be divided into mini-batches. Batch size is the total number of training samples
present in a single min-batch. An iteration is a single gradient update (update of the model's
weights) during training. The number of iterations is equivalent to the number of batches
needed to complete one epoch.
So if a dataset includes 1,000 images split into mini-batches of 100 images, it will
take 10 iterations to complete a single epoch.
VGG Neural Networks

While previous derivatives of AlexNet focused on smaller window sizes and strides in
the first convolutional layer, VGG addresses another very important aspect of CNNs: depth.
Let’s go over the architecture of VGG:
Input. VGG takes in a 224x224 pixel RGB image. For the ImageNet competition, the authors
cropped out the centre 224x224 patch in each image to keep the input image size consistent.
Convolutional Layers. The convolutional layers in VGG use a very small receptive
field (3x3, the smallest possible size that still captures left/right and up/down). There are also
1x1 convolution filters which act as a linear transformation of the input, which is followed by
a ReLU unit. The convolution stride is fixed to 1 pixel so that the spatial resolution is
preserved after convolution.
Fully-Connected Layers. VGG has three fully-connected layers: the first two have
4096 channels each and the third has 1000 channels, 1 for each class.
Hidden Layers. All of VGG’s hidden layers use ReLU (a huge innovation from AlexNet that
cut training time). VGG does not generally use Local Response Normalization (LRN), as
LRN increases memory consumption and training time with no particular increase in
accuracy.
The Difference. VGG, while based off of AlexNet, has several differences that
separates it from other competing models:
Instead of using large receptive fields like AlexNet (11x11 with a stride of 4), VGG uses very
small receptive fields (3x3 with a stride of 1). Because there are now three ReLU units
instead of just one, the decision function is more
discriminative. There are also fewer parameters (27 times the number of channels instead of
AlexNet’s 49 times the number of channels).
VGG incorporates 1x1 convolutional layers to make the decision function more non-
linear without changing the receptive fields.
The small-size convolution filters allow VGG to have a large number of weight
layers; of course, more layers leads to improved performance. This isn’t an uncommon
feature, though. GoogLeNet, another model that uses deep CNNs and small convolution
filters, was also shown in the 2014 ImageNet competition.
Xception Classification

We present an interpretation of Inception modules in convolutional neural networks


as being an intermediate step in-between regular convolution and the depthwise separable
convolution operation (a depthwise convolution followed by a pointwise convolution). In
this light, a depthwise separable convolution can be understood as an Inception module with
a maximally large number of towers. This observation leads us to propose a novel deep
convolutional neural network architecture inspired by Inception, where Inception modules
have been replaced with depth wise separable convolutions. We show that this architecture,
dubbed Xception, slightly outperforms Inception V3 on the ImageNet dataset (which
Inception V3 was designed for), and significantly outperforms Inception V3 on a larger
image classification dataset comprising 350 million images and 17,000 classes. Since the
Xception architecture has the same number of parameters as Inception V3, the performance
gains are not due to increased capacity but rather to a more efficient use of model
parameters.
CHAPTER 4

SYSTEM DESIGN

4.1 ARCHITECTURE DIAGRAM

Fig 4.1 Architecture Diagram


4.2 UML DIAGRAMS

4.2.1 USE CASE DIAGRAM

Fig 4.2.1 Use Case Diagram


4.2.2 SEQUENCE DIAGRAM

4.2.2 Sequence Diagram


CHAPTER 5

MODULE DESCRIPTION

5.1 MODULES

● Collecting Covid CT Dataset

● Data Pre-processing and Augmentation

● Convolutional Neural Network

● Transfer Learning

● Fine-Tuning the Architectures

5.1.1 Collecting Covid CT Dataset

The images are collected from COVID19-related papers from aRxiv, bioRxiv, NEJM,
JAMA, Lancet, etc.We first collected 760 preprints about COVID-19 from medRxiv2 and
bioRxiv3 , posted from Jan 19th to Mar 25th. Many of these preprints report patient cases of
COVID-19 and some of them show CT images in the reports. CT images are associated with
captions describing the clinical findings in the CTs. We used PyM PDF 4 to extract the low-
level structure information of the PDF files of preprints and located all the embedded figures.
The quality (including resolution, size, etc.) of figures were well-preserved. From the
structure information, we also identified the captions associated with figures. Given these
extracted figures and captions, we first manually selected all CT images. Then for each CT
image, we read the associated caption to judge whether it is positive for COVID-19. If not
able to judge from the caption, we located the text analysing this figure in the preprint to
make a decision. For each CT image, we also collected the meta information extracted from
the paper, such as patient age, gender, location, medical history, scan time, severity of
COVID-19, and radiology report.
5.1.2 Data Preprocessing and Augmentation

Each image had to be preprocessed according to the deep neural network used. There
were two important steps involved: resizing and normalisation. Different neural networks
require images of different sizes according to their defined architecture. ResNet18,
DenseNet121, and MobileNetV2 expect images of size 224 × 224, while InceptionV3 and
Exception require images of size 229 × 229. All the images were also normalised according
to the respective architectures. Adequate training of a neural net requires big data. With less
data availability, parameters are undermined, and learned networks generalise poorly. Data
augmentation solves this problem by utilising existing data more efficiently. It aids in
increasing the size of the existing training dataset and helps the model not to overfit this
dataset. In this case, there were a total of 1283 images of the normal (healthy) case and 3873
images of the pneumonia case in the training dataset. Out of these, four-hundred images were
reserved for optimising the weighted classifier. This dataset was highly imbalanced. There
were already enough images in the pneumonia case. Therefore, each image of only the
normal (healthy) case was augmented twice. Finally, after augmentation, there were 3399
healthy chest MRI images and 3623 chest MRI images.

5.1.3 Feature Extraction using CNN

First used CNN, in 1989, for handwritten zip code recognition. This is a type of feed-
forward network. The main advantage of CNN compared to its predecessors is that it is
capable of detecting the relevant features without any human supervision. A series of
convolution and pooling operations is performed on the input image, which is followed by a
single or multiple fully connected layers. The output layer depends on the operations being
performed. For multiclass classification, the output layer is a softmax layer. The main
disadvantage with deeper CNNs is vanishing gradients, which can be solved by using residual
networks introduced in the following section.

5.1.4 Transfer Learning

In transfer learning, a model that is trained for a particular task is employed as the
starting point for solving another task. Therefore, in transfer learning, pre-trained models are
used as the starting point for some specific tasks, instead of going through the long process of
training with randomly initialised weights. Hence, it helps with saving the substantial
computer resources needed to develop neural network models to solve these problems.used
domain, task, and marginal probabilities to propose a framework for better understanding the
transfer learning. The domain D was defined as a two-element tuple consisting of the feature
space, χ, with a marginal probability, P(X), where X is a sample data point. Hence,
mathematically, domain D can be defined as,
D={χ,P(X)}
(1) Here, χ is the space of all term vectors, xi is the ith term vector corresponding to some
documents, and X is a particular learning sample (X=x1,⋯,xn,∈χ).
For a given domain D, the given task T is defined as:
T={γ,P(Y∣X)}={γ,η},Y={y1,⋯,yn},yi∈γ
(2) where γ is the label space. η is a predictive function learned from the feature vector/label
pairs (xi,yi), where xi∈χ and yi∈γ.
η(xi)=yi
(3) Here, η predicts a label for each feature vector.
Due to the lack of a sufficient dataset, training a deep learning based model for medical
diagnosis related problems is computationally expensive, and the results achieved are also not
up to the mark. Hence, pre-trained deep learning models, which were previously trained on
ImageNet dataset, were used in this paper. Further, all these pre-trained models were fine-
tuned for pneumonia classification. All the layers of the architectures used were trainable.
Further details, related to fine-tuning.

5.1.5 Fine-Tuning the Architectures

All the architecture details used in this paper are discussed in A. Raw chest MRI
images, after being pre-processed and normalised, were used to train the network. Then, data
augmentation techniques were used to process the dataset more efficiently. All the layers of
the networks used were trainable, and these layers extracted the features from the images.
Some parameters must be set to train the network. An interesting paper came out, and
according to it, stochastic gradient descent (SGD) had better generalisation than adaptive
optimizers. Therefore, SGD as the optimizer was used, and the model was trained for 25
epochs. The learning rate, the momentum, and the weight decay were set to 0.001, 0.9, and
0.0001, respectively. These configurations were to make sure that the networks were fine-
tuned for pneumonia diagnosis.
Training an image using a Algorithm.

This is a type of feed-forward network. The main advantage of CNN compared to its
predecessors is that it is capable of detecting the relevant features without any human
supervision. ConvNets are more powerful than machine learning algorithms and are also
computationally efficient. These numerical values are then put into numerical arrays based on
their categorised characteristics. These arrays are then put into different nodes in the network
and passed through multiple iterations based on the input given. The CNN models are used
for geographical classification in multiple companies which require data to be classified in a
quick and secure way; it almost acts like a filter removing dust and separating the features of
the images. A series of convolution and pooling operations is performed on the input image,
which is followed by a single or multiple fully connected layers. The output layer depends on
the operations being performed. For multiclass classification, the output layer is a softmax
layer.During the training process, in order to make the results reproducible and more
convincing, a random seed was fixed. Randomly divide the training set and the test set at a
ratio close to 9: 1.Feature classification is used for Covid19 disease detection. The diseased
features are removed from the human and classified with the healthy lung image. When the
lung is healthy and there is no classification the results are shown as healthy and when there
is a disease which when grey scaled shows black spots, it classifies them so they are shown as
which disease they are and the confidence of the classification. Classification takes place
between two numerical arrays. If the numerical arrays match, then it is a healthy or diseased
lungs, depending upon the dataset provided. Classification is a simple but relevant procedure
which gives a proper result and is used in plant disease detection.
CHAPTER 7

SYSTEM TESTING

7.1 Unit Testing

Unit testing is a level of software testing where individual units/components of a


software are tested. The purpose is to validate that each unit of the software performs are
designed. A unit test is the smallest testable part of any software. Unit testing is the first level
of software testing and is performed prior to integration testing. Also called White box
testing.

7.2 Integration Testing

Integration testing is defined as a type of testing where software modules are


integrated logically and tested as a group. The purpose of this level of testing is to expose
defects in the interaction between these software modules when they are integrated.

7.3 SYSTEM TESTING

System testing falls under the black box testing. System involves the external
workings of the software from the user’s perspective.

Screenshot here…

Fig 7.1 External Workings


● Dataset is passed into the Model with the use of Algorithm Once the model is trained

then we can save it in a PKL or H5 format.

● We will run the Accuracy test to validate our model.

7.4 USER MANUAL

● Open a ipynb file in Google Cloud

● Upload a Both Ct-Image and Chest X Ray image to the Model

● Load the covid and normal images into the ResNet algorithm, Xception, VGG,

Inception models.

● Label the data with the appropriate attributes.

● Train an algorithm in a notebook using GPU’s on google cloud.

● Save the Machine Learning Model in a h5 format.

● Run a Flask server in the Localhost in 127.0.0.1 port 5000

● Load the Trained model to the App

● Click the Detect covid button

● Then click select button and select the input image

● Click upload image

● Upload the input image to models

● Display the Result probability accuracy.


CHAPTER 8

APPENDIX

8.1 SCREENSHOTS

Home Page

Screenshot here…

About

Screenshot here…
Preventions

Screenshot here…

News

Screenshot here…
Contact Us

Screenshot here…
Image uploading

Screenshot here…

Input Image Model

Screenshot here…
Model Prediction 1

Screenshot here…

Model Prediction 2

Screenshot here…
CHAPTER 9
CONCLUSION AND FUTURE ENHANCEMENT

9.1 CONCLUSION

In response to this outbreak of COVID-19, deep learning has played an indispensable


role, which makes it possible to accurately judge and respond to the epidemic. We researched
the analytical and diagnostic capabilities of deep learning on chest radiographs and present an
image classifier based on the COVID-Net to classify chest MRI images. Our model aims at
the transfer learning, model integration and classifying chest MRI images according to three
labels: normal, COVID-19 and viral pneumonia. According to the accuracy and loss value,
choose the models ResNet-101 and ResNet-152 with good effect for fusion, and dynamically
improve their weight ratio during the training process. After training, the model can achieve
96.1% of the types of chest MRI images accuracy on the test set. It provides a reference
method for medical and health institutions, government departments and even the global
diagnosis of COVID-19 epidemic situation.

9.2 FUTURE ENHANCEMENT

Covid-19 pandemic is a growing manifold daily. With the ever-increasing number of


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

[1] Ooi GC, Khong PL, Müller NL, Yiu WC, Zhou LJ, Ho JC, Lam B, Nicolaou S, Tsang
KW (2004) Severe acute respiratory syndrome:
[2] temporal lung changes at thin-section CT in 30 patients. Radiology 230(3):836–844 2.
Wong KT, Antonio GE, Hui DS, Lee N, Yuen EH, Wu A, Leung CB, Rainer TH, Cameron
P, Chung SS, Sung JJ (2003) Severe acute respiratory syndrome: radiographic appearances
and pattern of progression in 138 patients. Radiology 228(2):401–406
[3] Xie X, Li X, Wan S, Gong Y (2006) Mining x-ray images of SARS patients. In: Data
Mining. Springer, Berlin, pp 282–294
[4] Huang C, Wang Y, Li X, Ren L, Zhao J, Hu Y, Zhang L, Fan G, Xu J, Gu X, Cheng Z
(2020) Clinical features of patients infected with 2019 novel coronavirus in Wuhan, China.
Lancet 395(10223):497– 506
[5] Wang Y, Hu M, Li Q, Zhang XP, Zhai G, Yao N (2020) Abnormal respiratory patterns
classifier may contribute to large-scale screening of people infected with COVID-19 in an
accurate and unobtrusive manner. arXiv preprint arXiv:2002.05534
[6] Koo HJ, Lim S, Choe J, Choi SH, Sung H, Do KH (2018) Radiographic and CT features
of viral pneumonia. Radiographics 38(3):719–739
[7] Li L, Qin L, Xu Z, Yin Y, Wang X, Kong B, Bai J, Lu Y, Fang Z, Song Q, Cao K (2020)
Artificial intelligence distinguishes covid-19 from community acquired pneumonia on chest
ct. Radiology: 200905
[8] Hansell DM, Bankier AA, MacMahon H, McLoud TC, Muller NL, Remy J (2008)
Fleischner society: glossary of terms for thoracic imaging. Radiology 246(3):697–722
[9] Narin A, Kaya C, Pamuk Z (2020) Automatic detection of coronavirus disease (covid-19)
using x-ray images and deep convolutional neural networks. arXiv preprint arXiv:2003.10849
[10] Apostolopoulos ID, Mpesiana TA (2020) Covid-19: automatic detection from x-ray
images utilising transfer learning with convolutional neural networks. Phys Eng Sci Med:1

You might also like