Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/360702927

Pneumonia Detection using CNN

Conference Paper · May 2022

CITATIONS READS

0 384

4 authors, including:

Pramoth K M Prabhakarraj Ravi


Bannari Amman Institute of Technology Bannari Amman Institute of Technology
2 PUBLICATIONS 0 CITATIONS 1 PUBLICATION 0 CITATIONS

SEE PROFILE SEE PROFILE

Daniel Madan Raja S


Bannari Amman Institute of Technology
22 PUBLICATIONS 80 CITATIONS

SEE PROFILE

All content following this page was uploaded by Pramoth K M on 19 May 2022.

The user has requested enhancement of the downloaded file.


pneumonia radiologist needs to see the chest X-rays and
Pneumonia he/she wants to revive the expert precisely. The
Detection using essential objective of this model is to recognize if the

CNN individual has Pneumonia or not with high accuracy so


the individual can look for treatment rapidly. Significant
Mr PRAMOTH K M1,
Mr PRABHAKARRAJ RAVI2, Learning models which are arranged precisely by using
Mr SAJITH S3 extraordinary datasets can be valuable for subject
1Department of Information Technology, Bannari
matter experts. To set up the model for recognizing
Amman Institute of Technology, Sathyamangalam
(pramoth.it18@bitsathy.ac.in), whether or not the individual has pneumonia, A
2Department of Information Technology, Bannari Convolutional Neural Network (CNN) is used. The CNN
Amman Institute of Technology, Sathyamangalam can set up the photos of chest X-rays and thereafter it
(prabhakarrajravi.it18@bitsathy.ac.in),
can expect high precision.
3Department of Information Technology, Bannari
Amman Institute of Technology, Sathyamangalam Key Words: Chest X-ray, Deep Learning, CNN, Datasets
(sajith.it18@bitsathy.ac.in).
Dataset - Chest X-Ray Images (Pneumonia) |
Kaggle
ABSTRACT:

Pneumonia is an illness that encourages the air INTRODUCTION:

sacs in one of the two lungs. The air sacs could stack up One of the major factors associated with
with fluid or release (purulent material), causing hack pneumonia in children is indoor air pollution. Apart from
with bodily fluid or release, fever, chills, and this, under-nutrition, lack of safe water, sanitation, and
inconvenience unwinding. An arrangement of animals, basic health facilities are also major factors. Pneumonia
including minute living beings, diseases, and parasites, is an interstitial lung disease caused by bacteria, fungi,
can cause pneumonia. Pneumonia can go as a general or viruses. There are three types of pneumonia
rule from delicate to dangerous. It is for the most part inflammation in lungs - Type 1 Upper Lobe inflammation
critical for children and children more energetic than five - Type 2 Middle lobe inflammation – Type 3 Lower lobe
years of age, people more prepared than age 65, and inflammation. Deep Learning is one of the scientific
people with ailments or weakened safe structures. fields in Computer Science that actually helps the
Pneumonia killed 808 694 children more youthful than 5 application to learn from pre-defined experiences. The
in 2017, addressing 15% of all passing of adolescents Deep Learning domain is very useful for the prediction of
under five years old. Pneumonia impacts adolescents diseases in an individual by datasets that were learned
and families everywhere anyway is most normal in South by the application using Deep Learning. Pneumonia
Asia and sub-Saharan Africa. To save significant lives of detection using Deep Learning actually predicts the
numerous people and individuals and advancement using the dataset and algorithms for better accuracy and
should impart. Chest X-rays are used for recognizing the precise results. Our Motivation is to bundle all the
Pneumonia infection and to track down the corrupted progress into a Mobile Application for the users to utilize
locale in the lungs. Accordingly, To perceive the the tool properly. Since the project solely depends upon
two domains i.e., Deep Learning and Mobile App transmission in Asia Pacific countries using deep neural
Development, there would be a lot of challenging tasks networks. Personal And Ubiquitous Computing.
will be present in the project. Each Individual in the
Deng J, Dong W, Socher R, Li L, Li K & Fei-Fei, et
project has undertaken a specified task to achieve the
al: Imagenet: A large-scale hierarchical image database.
maximum efficiency of the project. Each Individual
2009 IEEE Conference On Computer Vision And Pattern
shares an equal amount of work so the members of the
Recognition.
project could really get every technical aspect of the
Dalhoumi S, Dray G, Montmain J, Derosière G &
project. The Basic Tasks of this project can be classified
Perrey S et al: An adaptive accuracy-weighted ensemble
into 3 types, developing an environment to train the
for inter-subjects classification in brain-computer
model using datasets, Converting the Keras H5 format
interfacing. 2015 7th International IEEE/EMBS
file into the Tflite model, and Integrating the model in
Conference On Neural Engineering (NER).
the mobile application for the User Experience. Later the
flutter application can be used to predict pneumonia Albahli S, Rauf H, Algosaibi A & Balas V et al: AI-

using chest X-ray pictures without any Backend server. driven deep CNN approach for multi-label pathology
classification using chest X-Rays. PeerJ Computer
LITERATURE SURVEY: Science.

Chandra T & Verma K, et al: Pneumonia AIM AND OBJECTIVE:


detection on chest X-ray using machine learning
The ultimate aim of this project, ‘Pneumonia
paradigm. Proceedings of 3rd International Conference
Detection’ is to develop a system or a model which can
on Computer Vision and Image Processing.
actually detect pneumonia with chest X-ray with higher
Williams G, Macaskill P, Fitzgerald D, Isaacs D, accuracy results by combining different deep learning
Codarini M, et al: Variability and accuracy in algorithms such as CNN Algorithm, DenseNet, VGG16,
interpretation of consolidation on chest radiography for ResNet, Inception Net (GoogLeNet). Each Algorithm is
diagnosing pneumonia in children under 5 years of age. undertaken for accuracy purposes, the one with the
Pediatric Pulmonology. best accuracy results and precise prediction will be

Kermany D, Zhang K & Goldbaum M, et al: taken into account as a model.

Labeled Optical Coherence Tomography (OCT) and Chest The basic Objectives of this project ‘Pneumonia

X-Ray Images for Classification. Detection are:


1. Fast and Reliable Results using Deep Learning.
Kuo K, Talley P, Huang C & Cheng L, et al:
2. Mobile Application for Convenience.
Predicting hospital-acquired pneumonia among
3. Time-Saving and Cost Reliable.
schizophrenic patients: a machine learning approach.
BMC Medical Informatics And Decision Making.

Rauf H, Lali M, Khan M, Kadry S, Alolaiyan H,


Razaq A, et al: Time series forecasting of COVID-19
SCOPE OF THE PROJECT: Kaggle Website. Then the collected datasets will be
When there exists a real-time problem, the trained using the Deep Learning Algorithm such as CNN,
scope of its solution will be much more attractive to the ResNet, VGG16, DenseNet, and Inception Net for better
individuals who would be benefited from the solutions. accuracy purposes. Then, the best algorithm is taken and
In this diabetes prediction there are some scopes that rendered into the model. Then the model will be
will be benefited the end-users: converted into a Tflite model. Which will be loaded in
1. Pneumonia is not a spreadable disease. the Flutter application UI.
2. One of the great advantages of pneumonia is PROBLEM STATEMENT:

it can be detected priorly before it gets more Pneumonia is most common in underdeveloped
and developing countries, where overpopulation,
complex. This is where the prediction comes
pollution, and unhygienic environmental conditions
into the picture
exacerbate the situation, and medical resources are
3. Our project ‘Pneumonia Detection’ contains scanty. Therefore, early diagnosis and management can
about 5863 datasets of pneumonia-affected play a pivotal role in preventing the disease from

patients with unique attributes. becoming fatal. Radiological examination of the lungs
using computed tomography (CT), magnetic resonance
4. With the usage of different Deep Learning
imaging (MRI), or radiography (X-rays) is frequently used
Algorithms, we can find the percentage of
for diagnosis.
prediction for maximum efficiency.
Our Project is built strategically by collecting
5. CNN, ResNet, DenseNet, VGG, and GoogLeNet various datasets of unique valued attributes for accurate
are the algorithm used here for the results. The primary domain that we are implementing

betterment of the model to train. is Deep learning with 5 algorithms to check the
maximum prediction accuracy. The Algorithms are
6. At last, users can download the mobile
namely CNN, ResNet, DenseNet, VGG, and GoogLeNet.
application to check for pneumonia in a neat
Out of these algorithms, the best algorithm with the
clean User Interface. highest prediction accuracy is taken and validated for

7. This Pneumonia Detection helps the users to the final model.

check the prediction anywhere wanted with MATERIALS AND METHODS:

absolutely no cost and in a small span of time. The Materials that we are using is totally depend

Python is the language we are totally depend on while upon Software, no hardware component is necessary
here. In this Project, about 3 Environments are widely
training the model. For the Mobile Application
used are Anaconda – Spyder, google-colab and Flutter.
Development, dart language is used. At first, we are
Anaconda is the distribution software which comprises
planning to collect as much as dataset we can from the
R language and Python primarily, it handles the package
management and deployment with ease. Spyder is a MODELING:
subsets of Anaconda. Spyder and Google-colab
The Initial Phase of the project starts by collecting
Environments are required to train the models using
the Dataset. Then for training purposes, Python is
Deep Learning Techniques. The Language that we are
primarily used, scalable and easy to understand for the
using here to implement, visualize, analyze, and to train
developer when python is used as a main programming
the model is Python. Flutter Environment is used for the
language in the project. The estimated completion of
Mobile Application Development to provide an Android
prototype modeling takes about 2 – 3 weeks.
Application to the Users.
Mobile Application is created using Flutter for
TOOLS USED:
Validation and User Experience purposes, every testing
• Anaconda – Spyder is done through the mobile application in an
• Google colab architectural manner. The Model was working well with
• Flutter less accuracy, now more and more datasets are fed and
updated in the model using different algorithms for
LIBRARIES USED:
maximum output purposes.
• Numpy
METHODOLOGY:
• Cv2
Below Mentioned Bulletins are the Tasks and Sub-
• Keras
tasks prepared and processed in order to achieve the
• Matplotlib
aims and objectives of the project.
• Tflite
• The Project solely depends upon the dataset of
ARCHITECTURE USED:
pneumonia patient’s attributes for prediction, so
• GoogLeNet datasets are fetched from the website called
• ResNet ‘Kaggle’
• CNN Website Link: Chest X-Ray Images (Pneumonia) |
• DenseNet Kaggle

• VGG16 • About 5863 unique attribute datasets are collected


from the Kaggle website for precise model rendering
LANGUAGES USED:
using Deep Learning.
• Python
• Anaconda is a Data Science Tool which we’ve used it
• Dart
as a platform to implement our project. In
Anaconda-Spyder and Google-colab are the two
Environments chosen for this Project.
• Spyder is ideal for processing the dataset and
training the model with a suitable environment and
also with required packages, whereas Tflite is
chosen for deploying deep learning models on • As an added feature the app is integrated with a
mobile and IOT devices. website using Webview, which provides Symptom
• In the Spyder IDE, at first, collected datasets were predictor and contact Doctor facilities
cleaned to find the dirty data to prevent the wrong
ALGORITHMS:
prediction. After Cleaning, every dataset is trained
Pneumonia Detection can be implemented in
using different Deep Learning Algorithms with
many algorithms of Deep Learning. So, we have chosen
different environments respectively.
some of the algorithms and started to implement each
• Each Dataset is trained using different Algorithms
one in a separate environment to test their efficiency,
such as CNN, ResNet, DenseNet, VGG and
time consumption, and accuracy results. There are 5
GoogLeNet for better accurate results.
Algorithms we initially used here:
• After the training, trained respective algorithms
model is then fitted using KERAS Library which is a • CNN
package in the Spyder IDE.
• ResNet
• Respective Packages are installed in the Spyder IDE
to activate functionalities of respective libraries. • DenseNet
• The Model is then saved as a Model.h5 file
• GoogLeNet
• Until here, the Deep Learning Part is completed in
the Spyder IDE, now Tflite library comes into play. • VGG

• For deploying the trained model in mobile devices, CNN Algorithm – CNNs have been popular due to
Android, IOS we need to convert Keras h5 model their improved performance in image classification.
into tflite model using Tensorflow Lite Library. The convolutional layers in the network along with
• Training the data, building a Model, Back-end filters help in extracting the spatial and temporal
works are developed and tested manually, now for features in an image. The layers have a weight-sharing
the User Interface, Mobile Application is technique, which helps in reducing computation
Developed. efforts.
• Flutter is an environment for the Mobile App Architecture-wise, CNNs are simply feedforwarded
Development. Dart Language is used here to artificial neural networks (ANNs) with two constraints:
develop an application. With a Clean and Simple neurons in the same filter are only connected to local
User Interface, the mobile app is created. Now, the patches of the image to preserve the spatial structure
tflite model is deployed using Tflite dependencies and their weights are shared to reduce the total
in Flutter . number of the model’s parameters. A CNN consists of
• Now Users are provided with interface to upload three building blocks: (i) a convolution layer to learn
pictures of X-ray using image picker dependency features, (ii) a max-pooling (subsampling) layer is to
and it displays the output of pneumonia or normal down sample the image and reduce the dimensionality
lungs with accuracy percentage. and thereby reduction in computational efforts, and
(iii) a fully connected layer to equip the network with number of parameters. To control the computational
classification capabilities complexity, the GoogLeNet model uses inception blocks
with dimension reduction, rather than the naive
inception. The performance of GoogLeNet, in which the
inception block was introduced, proves that an optimal
sparse architecture built from the available dense
building blocks improves the performance of artificial
neural networks for computer vision tasks.

ResNet – ResNet, which is a short form of


Residual Network, was originally developed for two
problems, such as the vanishing gradient and
degradation problem. Residual learning tries to solve
both these problems. ResNet has three different
variants: ResNet18, ResNet50, and ResNet101 based on
the number of layers in the residual network. ResNet
was successfully used in biomedical image classification
for transfer learning. In this paper, we have used
ResNet18 for pneumonia detection. Typically, deep VGG16 - Presented in 2014, VGG16 has a very

neural network layers learn low- or high-level features simple and classical architecture, with blocks of 2 or 3

during training, while ResNet learns residuals instead of convolutional layers followed by a pooling layer, plus a

features. final dense network composed of 2 hidden layers (of


4096 nodes each) and one output layer (of 1000
nodes). Only 3x3 filters are used.

GoogLeNet - The GoogLeNet architecture is a


DenseNet – DenseNet, which is a short form of the
22-layer deep network consisting of “inception
Dense Convolutional Network, needs fewer numbers of
modules,” instead of uniformly progressive layers. An
parameters than a conventional CNN, as it does not
inception block accommodates a large number of units
learn redundant feature maps. The layers in DenseNet
at each stage by hosting parallel convolution and
are very narrow, i.e., 12 filters, which add a lesser set of
pooling layers, resulting in an uncontrolled
new feature maps. DenseNet has four different variants:
computational complexity because of the increased
DenseNet121, DenseNet169, DenseNet201, and RESULTS:
DenseNet264. In this paper, we have used DenseNet121
The Ultimate aim and motto of this project
for pneumonia detection. Each layer in DenseNet has
‘Pneumonia Detection’ is to bring awareness among
direct access to the original input image and gradients
the people that pneumonia can be predicted earlier
from the loss function. Therefore, the computational
and can be cured with certain preventive measures. So
cost is significantly reduced, which makes DenseNet a
that we have used different algorithms to test their
better choice for image classification.
efficiency, throughput, and their accuracy percentage.
CNN, ResNet, DenseNet, VGG and Inception Net
Algorithms are widely used in Deep Learning Domain to
predict numerous numbers of diseases. We have
trained the dataset using 5 different types of algorithms
with 5 different accuracy results.

CNN Algorithm: In this Algorithm, the prediction


ANALYSIS:
efficiency was around 91.98%.
As are using here 5 different types of Deep
Learning algorithms, analysis of each algorithm is equally
ResNet Algorithm: In this Algorithm, the prediction
important in this project to get the maximum
efficiency was around 73.40%.
throughput at the end. Datasets are trained with
different algorithms in different environments for the
DenseNet Algorithm: In this Algorithm, the prediction
analysis. Each dataset is tested for the dirty data to clean
efficiency was around 87.18%.
the data and also to fill the null attributes in the dataset.
If any dataset contains null value attributes, we need to
VGG Algorithm: In this Algorithm, the prediction
manually enter the data to make it work. Out of these
efficiency was around 66.19%.
five Deep Learning Algorithms, We found CNN algorithm
to be the best providing with high training accuracy of
Inception Net Algorithm: In this Algorithm, the
98%.
prediction efficiency was around 76.76%.
Then the Trained model is saved as h5 file. The Keras Now, by comparing all these algorithms, CNN Algorithm
trained.h5 file is tested with test datasets. After has the best prediction percentage among the four
validating the output prediction received, The model is algorithms. Thus, the CNN algorithm was implemented
converted into Tflite model. And this model is loaded in in the mobile application.
flutter application. Mobile Application animations are
tested in the corner cases to find the bugs manually.
These Screenshots are taken from the Mobile
Application, ‘Pneumonia Detection, when the user
gives a Chest X-ray image, the image is loaded . Then
the image gets processed in the model.tflite file to
generate the prediction output and send the output to
the mobile application whether pneumonia is present
or not with its accuracy percentage.

The above graph is the result of an analysis of 5


different algorithms for Pneumonia detection. In this
graph, we clearly see that the CNN algorithm gives more paradigm. Proceedings Of 3rd International Conference
accuracy than other algorithms. So, we implement the On Computer Vision And Image Processing
CNN algorithm to detect pneumonia more accurately.
[3]. Williams G., Macaskill P., Kerr M., Fitzgerald D.,
CONCLUSION: Isaacs D., Codarini M., et al. Variability and accuracy in
interpretation of consolidation on chest radiography for
The result will be either classified as pneumonia
diagnosing pneumonia in children under 5 years of
present or not and their percentage, the detection of
age. Pediatric Pulmonology. 48, 1195–1200 (2013).
pneumonia is important in today’s scenario, and also
seeing its concerning factors. This project primarily [4]. Kermany D., Zhang K. & Goldbaum M. Labeled
focuses on detecting pneumonia with a given attribute Optical Coherence Tomography (OCT) and Chest X-Ray
in a span of time. This system will be useful for physicians Images for Classification. (Mendeley,2018).
to have an overall idea of the patient. So that preventive
[5]. Kuo K., Talley P., Huang C. & Cheng L. Predicting
measures will be given to the patients prior to the
hospital-acquired pneumonia among schizophrenic
percentage of pneumonia affected. Our Project used
patients: a machine learning approach. BMC Medical
Deep Learning Techniques for the prediction. In Deep
Informatics And Decision Making.(2021).
Learning, CNN Algorithm is chosen and given priority
[6]. Albahli S., Rauf H., Algosaibi A. & Balas V. AI-
over other algorithms and implemented in the model.
driven deep CNN approach for multi-label pathology
classification using chest X-Rays. PeerJ Computer
Building such types of systems will be
Science. 7 pp. e495 (2021) pmid:33977135
enormously helpful to patients, doctors, and hospitals.
Since the system predicts these diseases at a very early [7]. Rahman T., Chowdhury M., Khandakar A., Islam

stage, doctors can prescribe the medicines to prevent K., Islam K., Mahbub Z., et al. Transfer learning with deep

them permanently at the early stage thereby reducing convolutional neural network (CNN) for pneumonia

the pneumonia mortality rate. detection using chest X-ray. Applied Sciences. 10, 3233
(2020)

Since Deep Learning is vastly used in Computer


science fields for gaining machine intelligence, the X-ray
images of pneumonia patients are well studied by the
algorithm.

REFERENCE:

[1]. WHO Pneumonia. World Health Organization.


(2019).

[2]. Chandra T. & Verma K. Pneumonia detection on


chest X-Ray using machine learning

View publication stats

You might also like