You are on page 1of 10

60

THE JOURNAL OF ORIENTAL RESEARCH MADRAS ISSN : 0022-3301 | July 2021 49

AN ORDINAL APPROACH TO PNEUMONIA DETECTION FROM XRAY IMAGES


USING CONVOLUTIONAL NEURAL NETWORK (CNN)*

BY

Arpit Pandey
Department of Information Technology, UIT RGPV Bhopal, Madhya Pradesh, India ,
apandey6599@gmail.com

Akshat Jain
Department of Information Technology, UIT RGPV Bhopal, Madhya Pradesh, India ,
akshatjain722@gmail.com

Prabhat Bhargava
Department of Information Technology, UIT RGPV Bhopal, Madhya Pradesh, India ,
prabhatbhargava510@gmail.com

Anjana Pandey
Department of Information Technology, UIT RGPV Bhopal, Madhya Pradesh, India ,
anjanapandey@rgtu.net

Abstract. Technology is a new frame of advancement and various fields are making use of technology
in them for efficient results and productivity. One such field is medical science. As we all know that
it is a field incorporated with various life jacking diseases. Henceforth we understand it's time that we
bridge medical to technology so that we can save more lives. Here as a step to add our contribution
we aim to take up a very menacing disease into consideration. We will try to discuss pneumonia and
research about how early and efficient details can be brought by using deep learning with extract from
artificial intelligence helping in accurate detection of pneumonia and efficient modes of treatment.
Now pneumonia is a kind of infection linked with lungs entangling it with issues of breathing caused
by bacterial and viral bodies creating a huge danger. Dividing the paper into two sections where we
first begin by talking of the disease in order to get the utmost deepest knowledge and after that we
proceed to apply the concepts and notions of deep learning in order to fix the issues related to the
disease using the precision of knowledge obtained via studying pneumonia and concepts of deep
learning trying to inter connect both. We fix things by understanding concepts like pooling,
application of sigmoid activation function, Rectified Linear Activation Function, linear function and
their implementation. We fill gaps with better formation via studying various data sets and processing
the same data by understanding data processing into the zone of deep learning and its algorithm. As a
result of which we formed and studied a model from scratch which will detect whether a patient is
infected by Pneumonia or not by analysing the usual X-ray images. In this model 5216 images are
used in the training set for training the model and 624 images are in the test set to check the prediction
made by the model. Model will detect normal and pneumonia patients with an accuracy of 90.064102
ISSN : 0022-3301 | July 2021 61
Arpit Pandey, Akshat Jain, Prabhat Bhargava, Anjana Pandey

and loss of 0.379858. Hence the result of such a model is better screening of patients and further better
treatment and faster recovery. The essence remains to fix the existing system with productive methods
to save more lives.
Keywords: Pneumonia, convolution neural network, deep learning.

Received 08 June 2021, Accepted 19 June 2021, Published 01 July 2021



Correspondence Author: Arpit Pandey

Introduction
Pneumonia is spread when germs from one person's body enter the body of another[5]. There can be
various ways a person can get infected from pneumonia like when Infectious particles are breathed by
another person when a person with pneumonia coughs or sneezes. This is more likely to happen
between people that have a lot of contact with one another, such as parents and children, particularly
in places with insufficient ventilation, such as aeroplanes. When a person suffering from pneumonia
coughs into their hand, and then shakes their hand with another person, the other can get infected if
they touch their lips or eyes before cleansing their hands.

There are a number of basic measures that can be used to lessen the risk:

• Hands should be washed before meals, after touching any person, and going out in public on a
frequent basis.

• All surfaces in the house should be cleaned.

• During the cold and flu season, stay away from places with inadequate air filtering.

The majority of people recover from pneumonia without any long-term consequences. Pneumonia can
be fatal in persons who are already sick. Studies revealed that Pneumonia is the most deadly infection
among children who are less than five years old, taking the death toll to 16% in this age range globally.
People who are elderly or have a weakened immune system are also at a higher risk of developing
serious diseases.
62 THE JOURNAL OF ORIENTAL RESEARCH MADRAS [Vol. XCII-XVIII]

Literature Review
Pneumonia Detection through X-ray in the medical field is quite a challenging task and it needs a lot
of training to detect. Researchers are involved in this field to acquire the best results and techniques
to identify Pneumonia. Today CNN based techniques contribute excellent results and the practice of
using CNN is increasing day by day.

Tawsifur Rahman, et al. [1] proposed to train a model using a pre-trained model and patterns learned
from a pretrained model and apply it in our dataset to get better accuracy which is called transfer
learning. In this model various pretrained models are used to get better accuracy. Trained models in
AlexNet, ResNet18, DenseNet201 and Squeeze Net and got accuracy of 94.5%, 96.4%, 98%, 96.1%
respectively.

Pranav Rajpurkar, et al. [2], method proposed is to create a model with a huge dataset and train it
and then optimize and tune the model to get better accuracy. The F1 Score for the model is 95%.

Nischal Madiraju, et al. [3], method proposed is to create a model with a kaggle dataset and train
it and then optimize and tune the model to get better accuracy. Accuracy for the model is 89.73%.

Dimpy Varshni, et al. [4], method proposed is to train a model Using a pre-trained model and patterns
learned from a pretrained model and apply it in our dataset to get better accuracy which is called
transfer learning. In this model various pretrained models are used to get better accuracy. This Model
used various feature extractor and for that feature extractor it has used different classifiers and
analysed the result. In this model the highest accuracy was from the Densenet-169 of 80.02%.

Puneet Gupta , et al. [5], methods proposed are: Train a model Using a pre-trained model and patterns
learned from a pre-trained model and apply it in our dataset to get better accuracy which is called
transfer learning. Pretrained model used in this paper is VGG16 and VGG 19. Second method
proposed in this paper is to create a custom CNN model with different parameters and train the model
to see the accuracy. Training accuracy of the models are 97%, 95%, 99% respectively. and Test
Accuracy of 92%, 89%, 93% respectively.

Background of Deep Machine Learning Algorithms

The aim of Machine Learning is to see the world as Humans do, do tasks as humans do, and even use
this knowledge for many tasks such as video and image recognition, analysis of image and
classification, recreation of media, recommendation systems, natural language processing (NLP) , and
many more tasks. Deep Learning advancements in computer vision have been built and corrected.
ISSN : 0022-3301 | July 2021 63
Arpit Pandey, Akshat Jain, Prabhat Bhargava, Anjana Pandey

Convolutional Neural Network (CNN)

Convolutional Neural Network (CNN), also known as ConvNet, comes under Artificial Neural
Network (ANN) that, when compared to other FC-layer networks, has enhanced feeds and an
impressive potential to generate power, can detect highly embedded features of objects, particularly
location data, and can correctly determine. The in-depth CNN model has a limited number of
processing layers that can differentiate different aspects of input data (example, picture) using multiple
output levels. The first layers identify and create high-level functionalities (with low releases), and
the deeper layers create low-level functionalities (with high releases). CNN has emerged as a
promising mechanism for achieving promising results in a variety of computer vision applications
such as image categorization, object detection, face detection, speech recognition, vehicle
identification, face recognition, text recognition, and many other applications benefit from CNN's
weight sharing feature.

Fig. 1. Multi-Channeled Image

The convolutional neural network is fed a multi-channeled image as input, in this case the RGB image,
which is a three-channeled input. We can imagine how things can become extremely powerful once
the images reach a size of, say, 8K or 7680*4320 pixels. ConvNet's role is to reduce images into an
easy-to-process format while retaining the most important functionalities in obtaining good forecasts.
This is critical when we need to create a design that is both good for learning features and questionable
for large databases.

Fig. 2. Convolution Layer


64 THE JOURNAL OF ORIENTAL RESEARCH MADRAS [Vol. XCII-XVIII]

Convolution Layer- The Kernel

CNN combines functionality removal and functionality separation processes into a unified learning
body. During the training period, they can understand how to make improvements directly from the
green input. CNN neurons are less interconnected with tied weights than standard networks that are
completely connected to Multi - Layer Perceptrons ( MLP ) networks, allowing them to process large
inputs with better computational capabilities. Each hidden neuron in standard MLP has scalar weights,
input, and output. Due to the behavior of the 2D images, each neuron in CNN holds 2-D weighted
planes, known as kernels, and input and output known as the feature map.

The Kernel shifts often because of Stride Length = one (Non-Strided), when a matrix operation is
performed between K and therefore the P a part of the image during which the kernel moves. The
filter moves all through a particular range of Strides till it parses the complete breadth. Moving
forward, move to the start of the image with identical Stride worth and repeat the method till the
complete image is moving. In the case of multi-channel pictures (example RGB), Kernel has identical
depth because of the input image. matrix operation is performed between Kn and In stack ([K1, I1];
[K2, I2]; [K3, I3]) and every one results area unit summarized during a biased manner to offer a deep
regenerate channel with a Convoluted feature. The Convolution Operation's goal is to extract high-
quality features from the installation image, such as edges. ConvNets do not have to be limited to a
single Convolutional Layer. Typically, the first Convolutional Layer is in charge of capturing Low
Level features like edge, color, gradient, etc. The architecture supports the High-Level functionalities
as well with supplementary layers, providing us a network that understands all of the images in the
dataset in the identical way that we do.

Pooling Layer

Pooling layers are used to delay feature maps (generated after a convolution operation), e.g. take larger
feature maps and reduce them to lower feature maps. While minimizing feature maps it always retains
ISSN : 0022-3301 | July 2021 65
Arpit Pandey, Akshat Jain, Prabhat Bhargava, Anjana Pandey

the most important features (or details) in each step of the pool. Pooling function is performed similarly
to the convolutional functions by defining the strides and pooled size of operation.

Fully Connected Layer (FC Layer)


Adding a Fully-Associated Layer is a (usually) inexpensive way of learning nonlinear combinations
of advanced features represented by the convolution layer's output. In that scope, the Fully-Associated
layer is acquiring a possibly non-linear function. We will pierce the image into a column vector now
that we have transformed our input image into the appropriate form of our Multi-Level Perceptron.
Throughout all training sessions, flattened output is integrated into the feedforward neural network
and backpropagation is used. The model can distinguish between dominance and certain low-level
features in the images over time and then differentiate them using the Softmax Classification
technique.

Fig. 3. Fully Associated layer


66 THE JOURNAL OF ORIENTAL RESEARCH MADRAS [Vol. XCII-XVIII]

Proposed Methodology

This section provides a detailed description of the materials and methods used in the proposed system.

Dataset

In this work the kaggle dataset is employed. The dataset is arranged into three folders (train, test, val)
and contains subfolders for each image class, Pneumonia and Normal. There are five,863 X-Ray
pictures (JPEG) and some classes (Pneumonia/Normal). Chest X-ray pictures (anterior-posterior)
were hand-picked from retrospective cohorts of medicine patients of one to 5 years recent from Canton
girls and Children’s center , Guangzhou. All chest X-ray imaging was performed as a patients’ routine
clinical care[6].
For analysis, all chest radiographs were at first screened for internal control by removing all caliber
or unclear scans. The diagnoses for the photographs were then ranked by 2 knowledgeable physicians
before being cleared for coaching the AI system.

Fig. 4. X-ray Images of Human Respiratory System

Fig. 5. Comparison Analysis


ISSN : 0022-3301 | July 2021 67
Arpit Pandey, Akshat Jain, Prabhat Bhargava, Anjana Pandey

Data Pre-Processing

As image input of different algorithms differed, one of the most important tasks in data processing
was to expand the size of the X-Ray images. All of the images were standard according to the standards
of previously trained models.

Image Augmentation

Image data augmentation is a common data augmentation technique, in which images are transformed
through various random techniques such as image rotating, flipping, blurring, etc. All these random
operations are performed upon the original dataset.
There are different image augmentation techniques:
• Image Rotation
• Image Shifting
• Image Flipping
• Image Noising
• Image Blurring

Experimental Results
Fig. 6. Model Analysis
68 THE JOURNAL OF ORIENTAL RESEARCH MADRAS [Vol. XCII-XVIII]

As we can see the model summary in which the entire model structure is shown in which the first
convolutional layer is created with 128,128,3 size with the ReLu activation function. After the
convolutional layer there is a pooling layer of pool size 2,2. There are 3 convolutional layers and max
pooling layer with some dropout of 10% and 20% and at the last stages of the layer there is a flatten
layer to flatten the data so that we can get the output in the dense layer with the help of sigmoid
function.
Fig. 7. Analysis

Fig. 8. Comparison Analysis

As we can see model performance and our model gives 96.53% accuracy in the training set and
90.06% in the test set with the training loss of 0.09 and test loss of 0.37.

We can see the graph of model’s training accuracy vs test accuracy and training loss vs test loss in all
the 25 epochs in which our model is trained. Model accuracy is slightly increasing in every epoch and
model loss is decreasing in epochs.

Fig. 9. Model Output


ISSN : 0022-3301 | July 2021 69
Arpit Pandey, Akshat Jain, Prabhat Bhargava, Anjana Pandey

Conclusion
In this project we have created a model from scratch which will detect whether a patient is infected
by Pneumonia or not by processing their X-ray Image. As we have created our model from scratch
this makes it different from all the other models which use the Transfer Learning Approach and use
the pre-trained model to get better accuracy. We have achieved similar or better accuracy than most
of the Models. This research will continue in the future and we aim to reach Human Level Accuracy
and also we expand our work for various other medical fields.

This model will help doctors to identify whether a patient is infected by Pneumonia or not and it will
ease their work on detecting Pneumonia and saves their time. There are a lot of childrens who are
infected by Pneumonia every year. Early detection of Pneumonia will lead to proper treatment through
diagnosis of disease and can save lives of many People in the Country[7].

References
1. Tawsifur Rahman, Muhammad E. H. Chowdhury, Amith Khandakar, Khandaker R. Islam,
Khandaker F. Islam, Zaid B. Mahbub, Muhammad A. Kadir, Saad Kashem:
Transfer Learning with Deep Convolutional Neural Network (CNN) for Pneumonia Detection
using Chest X-ray
2. Pranav Rajpurkar , Jeremy Irvin, Kaylie Zhu, Brandon Yang, Hershel Mehta, Tony Duan, Daisy
Ding, Aarti Bagul, Robyn L. Ball, Curtis Langlotz, Katie Shpanskaya,
Matthew P. Lungren, Andrew Y. Ng: CheXNet: Radiologist-Level Pneumonia
Detection on Chest X-Rays with Deep Learning
3. Dimpy Varshni, Kartik Thakral, Lucky Agarwal, Rahul Nijhawan, Ankush Mittal: Pneumonia
Detection Using CNN based Feature Extraction
4. Puneet Gupta: Pneumonia Detection Using Convolutional Neural Networks
5. Okeke Stephen, Mangal Sain, Uchenna Joseph Maduh, Do-Un Jeong, "An Efficient Deep Learning
Approach to Pneumonia Classification in Healthcare", Journal of Healthcare Engineering, vol.
2019, Article ID 4180949, 7 pages, 2019.
6. D. K. Kermany and M. Goldbaum, Labeled Optical Coherence Tomography (OCT) and Chest X-
Ray Images for Classification, Mendeley Data, London, UK, 2018.
7. Mohammad Farukh Hashmi, Satyarth Katiyar, Avinash G Keskar, Neeraj Dhanraj
Bokde, Zong Woo Geem Efficient Pneumonia Detection in Chest Xray Images Using
Deep Transfer Learning Diagnostics (Basel) 2020 Jun; 10(6): 417. Published online
2020 Jun 19

You might also like