You are on page 1of 8

3rd International Conference on Emerging Technologies in Computer Engineering: Machine Learning and Internet of Things

(ICETCE-2020), 07-08 February 2020, (IEEE Conference Record # 48199)

Detection of Pediatric Pneumonia from Chest


X-Ray Images using CNN and Transfer
Learning
Gaurav Labhane Rutuja Pansare Saumil Maheshwari
Indian Institute of Information Indian Institute of Information ABV-Indian Institute of Information
Technology Pune Technology Pune Technology and
labhanegaurav@gmail.com rutujapansare.22@gmail.com ManagementGwalior
saumilmaheshwari@yahoo.co.in

Ritu Tiwari Anupam Shukla


ABV-Indian Institute of Information Technology and Indian Institute of Information Technology Pune
Management, Gwalior dranupamshukla@gmail.com
tiwariritu2@gmail.com

Abstract—Pneumonia is one of the most fatal diseases abnormalities and diseases, detection of nucleus, etc.
caused in the lungs. The diagnosis involves a chest x-ray With the advent of transfer learning, newer capabilities
which is interpreted by a radiologist. Human assisted have been added to CNN. Transfer learning models like
diagnosis has its own limitations like the availability of an VGG16, InceptionV3, etc. which are trained using
expert, cost, etc and hence an automated method for the
ImageNet dataset can be used to build faster and
detection of pneumonia from x-rays is a necessity. In this
research, neural network models were developed to detect effective models for the classification of images.
pneumonia from the chest x-ray images. Four models
Pneumonia is amongst the leading causes of death
namely a basic convolutional neural network (CNN),
due to infection in children below the age of 5 years
VGG16, VGG19, InceptionV3 were constructed using
CNN and transfer learning methodologies. The models globally. It is referred to as the infection caused in the
were then trained on a pediatric pneumonia dataset which air sacks in the lungs. There are various causes for it
comprised of 2992 pneumonia and 2972 normal chest x- which include different viruses, bacteria, and fungi. It
rays. The results were then tested using 854 pneumonia can have mild to severe effects on people belonging to
and 849 normal images, and an accuracy of over 97 any age group. Some types of pneumonia can be treated
percent was obtained from all models. with vaccines [4].
Index Terms: Pneumonia detection, Convolutional Chest x-ray is a simple, easy and effective way that
Neural Networks, Transfer Learning, VGG16, VGG19,
allows doctors to analyze inner organs or spot
InceptionV3.
abnormalities and diseases of the blood vessels, lungs,
heart, airways and bones. Pneumonia, which is caused
I. INTRODUCTION due to infection in lungs, can be detected from an x-ray
of the chest. In this research, automated models were
Medical Imaging has a huge scope for the developed for the detection of pneumonia from x-ray
application of recent advancements in computation. graphs without any human assistance.
The Convolutional Neural Networks (CNN’s) have
been a major breakthrough for image-based analysis. II. RELATED WORKS
They can be effectively used for image classification
[1]. In the past decade, there have been remarkable Chest x-rays are hard to interpret without an expert
works in the field of medicine especially in medical radiologist. A lot of researchers are striving to make x-
diagnostics. Deep Learning and CNN are being actively ray analysis automated. In February 2018, a group of
used in various medical researches especially those researchers designed a system based on a deep-learning
with image data. They are being used for lesion framework to classify the images for macular
segmentation [2], segmentation and classification of degeneration and diabetic retinopathy. It also classified
tumor [3], image enhancement, detection of pneumonia and normal chest X-ray images [5]. The
model was trained on pediatric chest X-ray images with

978-1-7281-1683-9/20/$31.00 ©2020 IEEE

Authorized licensed use limited to: Fondren Library Rice University. Downloaded on May 17,2020 at 05:58:34 UTC from IEEE Xplore. Restrictions apply.
5,232 images, out of which 3,883 were pneumonia and children. It used chest radiographs for classification to
1,349 were normal. Accuracy obtained by them was achieve a recall rate of 96.7%, and the f1-score of
92.8% with a93.2% sensitivity and 90.1%specificity. In 92.7%[8]. Also, some researchers have solely depended
2018 RSNA Pneumonia Challenge held on Kaggle, the on pure CNN without transfer learning for the
winning entry worked on pneumonia detection and classification of pneumonia images and achieved a
localization in chest x-ray using a fully convolutional validation accuracy of 93.73% [9]. The summary of a
network incorporated with features of object detection few researches on the same dataset as ours is shown in
[6]. TableI.

CheXNet is a 121-layer convolutional neural Another research proposed deep learning


network developed by researchers at Stanford that is architecture for the classification of pneumonia using
trained on ChestX-ray14 dataset. The deep learning chest x-rays. The model used convolutional neural
algorithms used by them have a higher accuracy than networks and residual network architecture for
that of an average radiologist in the identification of classifying the images. An accuracy of 78.73% was
pneumonia and other chest diseases from chest x-rays obtained, [10] which surpassed the previously top-
[7]. scoring accuracy of 76.8%.

Most recently, a methodology was proposed which Other than chest x-rays, there has been remarkable
used transfer learning and a deep residual network- work using convolutional neural networks and transfer
oriented approach for detection of pneumonia in learning.

TABLE I.SUMMARY OF RELATED WORK ON THE SAME DATASET

Comparison
Author Methods Value
Factor
Kermany, Daniel S., et al. (2018) [5] Transfer learning Accuracy 92%
Transfer learning Recall 96.7%
Liang, Gaobo, and Lixin Zheng(2019) [8] with deep residual
networks-oriented F1-score 92.7%
Validation
Stephen, Okeke, et al. (2019) [9] Pure CNN 93.73%
Accuracy

I. DATA DESCRIPTION AND


PREPROCESSING B. Data augmentation and balancing

A. Dataset
The dataset collected was not balanced. The ratio
In this study, the dataset used to train, test and of the number of pneumonia class images to normal
evaluate the models was [11]. 5856 X-Ray images class images was more than 2:1. Hence, to efficiently
were divided into two categories namely Pneumonia
train the model, the images in the normal class were
and Normal as shown in Fig. 1. 4273 images
belonged to the Pneumonia class and 1583 images augmented and the number of images in both classes
belonged to the Normal class. The x-ray images in were made almost equal. The image augmentation
this dataset were collected from patients with ages methods used were as follows:
between one and five years, from the Guangzhou
Women and Children’s Medical Center. • Horizontal flip – In this method, the images
were flipped horizontally and saved.
The original images were of high resolution and
varied sizes. To make the computation and training
• Zoom – The images were magnified 0.2
faster the images were resized to 256 x 256 pixels.
times of the original images.

86

Authorized licensed use limited to: Fondren Library Rice University. Downloaded on May 17,2020 at 05:58:34 UTC from IEEE Xplore. Restrictions apply.
network. The convolutional layers use a filter of
a fixed size to extract various features. The
scanning of the image is done by moving the
filter as per the strides specified.6 convolutional
layers with 32,32,64,64,128,128 filters
respectively were used in the simple CNN
model. In each layer, 2D convolutional filters of
size 3x3 and a stride of 1 was used.
Fig. 1. Dataset images
• Batch Normalisation
After data augmentation and balancing, the dataset
was divided into three parts. 70% of the images were Batch normalization is used to improve the
put in the training set, 20% in the testing set and 10 learning rate of the model. This layer normalizes
% in the validation set. The exact distribution is the input. In all the models, batch normalization
shown in Table II. was used after every convolutional layer.

TABLE II. DATA DISTRIBUTION IN TRAINING SET, • Pooling layer


TESTING SET, AND VALIDATION SET AFTER
AUGMENTATION AND BALANCING Pooling is the technique used to
downsample the feature map collected from the
convolutional layer. Two types of pooling
Pneumonia Normal
namely max pooling and average pooling are
Training set 2992 2972 most commonly used. In the simple CNN model,
Testing set 854 849 max-pooling was used after every convolutional
Validation set 427 424 layer with the pooling filter of the size of 2*2.
Total 4273 4245
• Activation

II. MODELS AND IMPLEMENTATION The activation function is used at the end of
a layer for the non-linear transformation of the
Four models were developed and trained using inputs. Nowadays, the most commonly used
the same dataset. The basic methodology used in the activation function in a convolutional neural
models was convolutional neural networks and network is Rectified Linear Unit i.e. ReLU.
transfer learning. The models proposed are as ReLU was used at the end of each layer and
follows: sigmoid activation function was used in the final
layer with two nodes.

A. Simple CNN
• Dropout
The neural network is made up of many smaller Dropout is the technique used to reduce
units called neurons or nodes which are arranged in overfitting of the model. Using dropout, some
the layered architecture. These nodes contain weights nodes in the layer are randomly chosen to stay
that are updated using optimizing techniques like inactive for some instances. In this way, it
backpropagation etc. while training the model. Every prevents the model from getting too familiar
CNN model is comprised of two parts i.e. the with the data. A dropout of 0.5 was used in dense
convolutional or feature extraction part and the layers for classification here.
classification part. All the components and structure
of the simple CNN model used are described as
follows and its complete architecture is shown in • Dense Layers
Table III. The output of the convolutional layer is
further flattened and given to the dense layer as
• Convolutional Layer input. The role of convolutional layers is to
extract the features and the classification of
Convolutional Layer forms the basic images is done by the dense layers. The simple
building block for a convolutional neural

87

Authorized licensed use limited to: Fondren Library Rice University. Downloaded on May 17,2020 at 05:58:34 UTC from IEEE Xplore. Restrictions apply.
CNN architecture had two dense layers with 32 B. Transfer learning models
nodes each and a final layer with 2 nodes.
Transfer learning models were developed using
the architecture of pre-trained models like VGG16,
TABLE III.CNN MODEL ARCHITECTURE VGG19, InceptionV3 and weights obtained by
training them on the ImageNet dataset. The
Layer Output Shape Params convolutional part was used from the pre-trained
Input (256,256,3) 0 models. The output of this block was further flattened
Convolution (254, 254, 32) 864 and given to the fully connected layers which used
batch normalization, dropout, and activation as used
Batch Normalization (254, 254, 32) 128
in the simple CNN model.
Activation (254, 254, 32) 0
Max Pooling (127, 127, 32) 0 After designing the model, it was trained with
Convolution (125, 125, 32) 9216 the images from our dataset. The training was done in
Batch Normalization (125, 125, 32) 128 two ways. One, the convolutional layers of the pre-
Activation (125, 125, 32) 0 trained models were frozen to keep the initial weights
Max Pooling (62, 62, 32) 0 unchanged and other weights were updated as the
Convolution (60, 60, 64) 18432 model was trained using the dataset. Second, the
Batch Normalization (60, 60, 64) 256 weights loaded initially were modified along with
Activation (60, 60, 64) 0 others when the model was trained. Accordingly,
Max Pooling (30, 30, 64) 0
three models using VGG16, VGG19 and InceptionV3
respectively were designed and tested.
Convolution (28, 28, 64) 36864
Batch Normalization (28, 28, 64) 256
III. RESULTS
Activation (28, 28, 64) 0
Max Pooling (14, 14, 64) 0 The models developed in the research were
Convolution (12, 12, 128) 73728 trained using the chest x-ray images, on which
Batch Normalization (12, 12, 128) 512 various augmentation techniques were applied.
Activation (12, 12, 128) 0 Kaggle’s kernels were used as GPU fortraining,
Max Pooling (6, 6, 128) 0 testing and validation of the models. The model
Convolution (4, 4, 128) 147456 yielded optimum results when trained on 100 epochs.
Batch Normalization (4, 4, 128) 512 Confusion matrices were then plotted by comparing
Activation (4, 4, 128) 0 the obtained values with the ground truths. The
Max Pooling (4, 4, 128) 0 overall efficiency of the model designed was judged
Flatten (512) 0 using the evaluation metrics of accuracy, precision,
Dense (32) 16384 recall and f1 score, calculated from the confusion
matrices drawn.
Batch Normalization (32) 128
Activation (32) 0 The graphs of validation accuracy against
Dropout (32) 0 training accuracy and validation loss against training
Dense (2) 66 loss of models are shown in Fig.2, Fig.3, Fig.4. and
Sigmoid Activation (2) 0 Fig.5.

88

Authorized licensed use limited to: Fondren Library Rice University. Downloaded on May 17,2020 at 05:58:34 UTC from IEEE Xplore. Restrictions apply.
Fig. 2.Graph of (a) Validation accuracy against Training Accuracy (b) Validation loss against Training loss for Basic CNN model.

Fig. 3. Graph of (a) Validation accuracy against Training Accuracy (b) Validation loss against Training loss for Basic VGG16
model which is trained by freezing the convolutional layers.

Fig. 4.Graph of (a) Validation accuracy against Training Accuracy (b) Validation loss against Training loss for Basic VGG19 model which is
trained by freezing the convolutional layers.

89

Authorized licensed use limited to: Fondren Library Rice University. Downloaded on May 17,2020 at 05:58:34 UTC from IEEE Xplore. Restrictions apply.
Fig. 5. Graph of (a) Validation accuracy against Training Accuracy (b) Validation loss against Training loss for Basic VGG19 model which is
trained by not freezing the convolutional layers.

While training with 100 epochs, the best model was models developed are shown in Fig.6. Further, the
saved where training accuracy is closest to the recall, precision, f1-score and testing accuracy of the
validation accuracy in order to obtain the most models were calculated to detect pneumonia from the
efficient results. A confusion matrix was then plotted chest x-ray images. The results were compared with
where the testing set was tested using the best model some of the previous researches on the same dataset,
saved. The confusion matrices obtained from all the as shown in Table IV.

90

Authorized licensed use limited to: Fondren Library Rice University. Downloaded on May 17,2020 at 05:58:34 UTC from IEEE Xplore. Restrictions apply.
Fig. 6.Confusion matrices of:(a) Simple CNN (b) VGG16 (c) VGG19 (d) InceptionV3.

TABLE IV.RESULTS SUMMARY OF ALL MODELS AND MODEL COMPARISON

Sr. Testing
Model / Author Name Accuracy Recall F1-score Precision
No images
1 Kermany, Daniel S., et al.(2018) [5] 624 92.8 % --- --- ---
2 Liang, Gaobo, and Lixin Zheng.(2019) [8] 624 90.5% 96.7% 0.92 ---
93.79%(Val
3 Stephen, Okeke, et al(2019) [9] 2314 idation --- --- ---
Accuracy)
Our Methods
Basic CNN 97 % 0.97 0.97 0.98
4 VGG16 1703 98 % 0.96 0.98 0.99
VGG19 97 % 0.95 0.97 0.99
InceptionV3 98 % 0.98 0.98 0.99

IV. DISCUSSION AND CONCLUSION

The models proposed in this research for the With advancements of computer applications in
detection of pediatric pneumonia on the frontal chest the medical sector, pediatric pneumonia can be
x-ray images using CNN and Transfer learning effectively detected using chest radiographs with the
approaches have significant results. Most recently, help of technologies like CNN and deep learning. In
there have been several researcheson the samedataset. this research, methodologies were developed using
However, our models have outperformed the results which pediatric pneumonia can be predicted with
from previous researches to attain state-of-the art. higher accuracy. Automated diagnosis in medical
Neural Networks were used to develop models for field is the key area that will benefit directly from our
efficient extraction of features from an x-ray image research.
and predict the presence or absence of pneumonia.
Also, in this research, the testing data was increased
by data augmentation techniques and thus, the
models were tested on a greater number of images as
compared to a few other approaches.

91

Authorized licensed use limited to: Fondren Library Rice University. Downloaded on May 17,2020 at 05:58:34 UTC from IEEE Xplore. Restrictions apply.
REFERENCES

[1] Krizhevsky, Alex, Ilya Sutskever, and Geoffrey E. Hinton.


"Imagenet classification with deep convolutional neural
networks." Advances in neural information processing systems.
2012.

[2] Kupinski, Matthew A., and Maryellen L. Giger. "Automated


seeded lesion segmentation on digital mammograms." IEEE
Transactions on medical imaging 17.4 (1998): 510-517.

[3] Xu, Yan, et al. "Deep convolutional activation features for


large scale brain tumor histopathology image classification and
segmentation." 2015 IEEE international conference on acoustics,
speech and signal processing (ICASSP). IEEE, 2015.

[4] CDC Features. Centers for Disease Control and Prevention,


Centers for Disease Control and Prevention, 22 Oct. 2018,
www.cdc.gov/pneumonia/index.html.

[5] Kermany, Daniel S., et al. "Identifying medical diagnoses and


treatable diseases by image-based deep learning." Cell 172.5
(2018): 1122-1131.

[6]The DeepRadiologyTeam,2018 RSNA Pneumonia Challenge,


Pneumonia Detection in Chest Radiographs, 21 Nov 2018.

[7] Rajpurkar, Pranav, et al. "Chexnet: Radiologist-level


pneumonia detection on chest x-rays with deep learning." arXiv
preprint arXiv:1711.05225 (2017).

[8] Liang, Gaobo, and Lixin Zheng. "A transfer learning method
with deep residual network for pediatric pneumonia
diagnosis." Computer Methods and Programs in
Biomedicine (2019).

[9] Stephen, Okeke, et al. "An Efficient Deep Learning Approach


to Pneumonia Classification in Healthcare." Journal of healthcare
engineering 2019 (2019).

[10] Saul, Can Jozef, Deniz Yagmur Urey, and Can


DorukTaktakoglu. "Early Diagnosis of Pneumonia with Deep
Learning." arXiv preprint arXiv:1904.00937 (2019).

[11] Kermany, D. K., and M. Goldbaum. "Labeled optical


coherence tomography (OCT) and Chest X-Ray images for
classification." Mendeley Data 2 (2018).

92

Authorized licensed use limited to: Fondren Library Rice University. Downloaded on May 17,2020 at 05:58:34 UTC from IEEE Xplore. Restrictions apply.

You might also like