2021 International Conference on Data Analytics for Business and Industry (ICDABI)
Pneumonia Classification Using Hybrid CNN
Architecture
Mohammed Mansur Abubakar1 Bashir Zak Adamu2 Muhammad Zaharaddeen Abubakar2
Computer Engineering Department Digital Forensics Engineering Department Digital Forensics Engineering Department
2021 International Conference on Data Analytics for Business and Industry (ICDABI) | 978-1-6654-1656-6/21/$31.00 ©2021 IEEE | DOI: 10.1109/ICDABI53623.2021.9655918
Firat University Firat University Firat University
Elazig, Turkey Elazig, Turkey Elazig, Turkey
almansurbukar@gmail.com bzakadamu@gmail.com mohd.abubakar19@gmail.com
Abstract—In this study, we propose a custom-built deep impactful deep convolutional neural network-based solutions
learning model for detecting pneumonia conditions by analyzing are in medical diagnostics. In this paper, our model is one of
radiographs. The hybrid CNN model is trained to classify those experimental studies indicating how effective these deep
distinguishable traces of pneumonia into three (3) different learning techniques can be in the medical field.
categories; bacterial, normal, and viral pneumonia x-ray
images. Experiments were conducted using the proposed hybrid III. RELATED WORK
CNN approach which is made of several convolution blocks with
Several research works have been conducted in the
custom weights and multiple fully connected layers for accurate
classification. The proposed deep learning model resulted in an medical field with a focus on applications of deep learning in
accuracy of 92.9%, which makes it the top-ranking model in medical imaging: chest x-rays. In [4] a modified convolutional
comparison to other models in this research. neural networks (CNN) based method is designed to analyze
images of the lungs and diagnose pneumonia infection using
Keywords— Chest X-ray, Classification, CNN, Deep learning, deep learning techniques. Thus, this is just a simple example
Hybrid, Bacterial, and Viral Pneumonia that shows relevant research work on chest x-rays in medical
diagnosis. In [5], the authors proposed customized
I. INTRODUCTION convolutional neural networks (CNN) with just a few
As one of the most common infectious diseases that cause convolution layers that classify lung diseases.
mild to life-threatening conditions in people of all ages, Moreover, scholarly sources indicate some published
pneumonia infection is behind 15% of all deaths of children articles on pneumonia chest x-ray imaging tasks. Amongst
under the age of 5 years. However, adults with preexisting these sources, one of them discusses using the deep learning-
health problems are at high risk also. The World Health based approach to identify and localize pneumonia in chest x-
Organization (WHO) estimates that as of 2017, pneumonia ray images [6]. Chest x-rays are usually employed by
killed about 800,000 children under 5 years [1]. There are researchers to enhance the medical capacity for the detection
several causes of pneumonia, however, the most common and diagnosis of several medical conditions [7].
infectious agents include viruses, bacteria, and fungi. Thus,
we focus our study on two of the agents mentioned. We Additionally, there is a study that diagnoses lung
believe the ability to detect these pneumonia traces in inflammation and lesions caused by Covid-19. The study was
radiograph images would enable clinicians with vital clinical conducted using chest x-ray images because of how suitable
information that makes pneumonia early detection easier to x-ray imaging is for differentiating lung diseases. This
handle and manage. research proposed a new CNN-based method called CNN-
COVID. This proposed method has been developed to classify
Early diagnosis of most infectious diseases is highly x-ray images [8].
important. Hence, we propose a hybrid solution for detecting
early signs of pneumonia in chest x-ray images which further IV. DATASET DESCRIPTION
classifies the category of pneumonia infecting agent, to detect
This experiment was conducted using the pneumonia chest
whether it is a viral or bacterial agent. The hybrid model can x-ray dataset gotten from the Mendeley data online repository
also identify chest x-ray images of normal (healthy) patients.
[9]. This publicly available data is also accessible on Kaggle
This solution could be deployed to areas with shortages of
[10] data repository. The source of these chest x-ray images
experienced personnel and health equipment. (anterior, posterior) is mainly from pediatric patients from
II. BACKGROUND Guangzhou Women and Children’s Medical Center,
Guangzhou. These images were further screened for quality
Advances in machine learning techniques stretch far back control by experts who deemed them valid for training
into antiquity which in recent years gave the rise to several machine learning-enabled systems. The dataset consists of
deep convolutional neural network (D-CNN) based models normal chest x-ray images and images of infected chest x-rays
[2]. This has been applied in several medical imaging and which are further categorized into two, bacterial and viral
detection tasks such as disease diagnosis, prediction, and pneumonia chest x-ray images. We further organized the
classification et al. These technologies have significantly publicly available dataset into 3 folders containing the image
changed the face of applying deep learning techniques in categories of (Bacterial/Normal/Viral) chest x-ray images.
medical applications [3]. The complex nature of the There are 5,000 chest x-ray images in .JPEG format [9]. As
convolutional neural network architectures gave it the shown in TABLE I, sample size of bacterial pneumonia images
potential to effectively extract useful and relevant features is 2000, a sample size of 1500 chest x-ray images for normal
from medical data which aids medical practitioner’s in making and 1500 chest x-ray images for viral pneumonia. These
clinical decisions. There are proven studies indicating how images are in posteroanterior (PA) view as seen in Fig. 1.
978-1-6654-1656-6/21/$31.00
Authorized licensed use limited to:©2021 IEEE
International 520
Islamic University Malaysia. Downloaded on July 20,2022 at 06:51:49 UTC from IEEE Xplore. Restrictions apply.
2021 International Conference on Data Analytics for Business and Industry (ICDABI)
TABLE I. CHEST X-RAY DATA DESCRIPTION.
Categories Bacterial Normal Viral Step 1: Read chest x-ray images.
Step 2: Images are augmented and preprocessed for
Number of Images 2000 1500 1500
training the hybrid model.
Step 3: Augmented chest x-ray images are the inputs of the
NASNet-Large model.
Step 4: New feature vectors are obtained from the
prediction layer (Layer 1241) of the model.
Step 5: Obtained feature vectors are then classified with
Support Vector Machine (SVM).
B. Evaluation Metrics
Performance metrics used in evaluating the proposed
method include the Accuracy, F1_Score, Sensitivity, and
specificity parameters [11], which are then compared with
some other higher accuracy models such as Resnet50 and
Resnet101 [12].
!"#!$
!"#%"#%$#!$
(1)
Fig. 1. Sample x-ray images from the pneumonia dataset. !"
!"#%"
(2)
V. PROPOSED METHODOLOGY !"
!"#%$
(3)
A. The Proposed Method
In this research, we used MATLAB Programming !$
(4)
language to modified NasNetLarge pre-trained network for the !$#%"
feature extraction. The output from NasNetLarge prediction
('()*+,+-+,. ∗ "1(2+*+3))
layer was used as the input to the support vector machine 2 ∗ ('()*+,+-+,. # "1(2+*+3)) (5)
(SVM) classifier. Hence, SVM was used for the final output
classification. The research further implemented some of the
high-performing models in comparison to the hybrid model. Equation (1) is used to measure the accuracy level of the
We used pre-trained resnet50 and resnet101 networks for model, (2) is used to measure the performance in terms of
feature extraction and classification. In this approach, all precision of the model, (3) measures the sensitivity often
models used had been trained for 3 output classes referred to as recall, (4) is used to measure the specificity
(Bacterial/Normal/Viral). Hence, the hybrid model emerged score, and (5) is used to measure the F1 score (sometimes
with the highest performance which makes it field-worthy for called the F measure).
the examination of pneumonia traces in chest x-ray images. VI. RESULTS AND DISCUSSION
Fig. 2. Shows the proposed hybrid model discussed in this
article. This study was conducted with an allotment of 70% of the
dataset for training data, 20% for test data, and 10% for
validation data. The training was conducted using the
stochastic gradient descent with momentum (SGDM) with a
learning rate of 0.001 (1e-3). Upon completion, the proposed
method gave an accuracy level of 92.9% emerging as the best
performing model in comparison to Resnet50 and Resnet101
pre-trained networks. Performance is evaluated using the
evaluation metrics described in the study. TABLE III shows
Fig. 2. The proposed method.
results achieved from the modified NasNetLarge in
comparison to resnet50 and resnet101. These models were
This hybrid method starts by reading the data using the used for the classification of bacterial pneumonia, viral
input layer which has an input size of 331 by 331, in grayscale pneumonia, and normal chest x-ray images.
format (331 x 331 x 1). However, the chest x-ray images are
of different sizes, and to resize these images we used the data TABLE II. PERFORMANCE OF THE PROPOSED METHOD
augmentation technique to change resize images to fit the
Sensitivity
Specificity
Accuracy
Precision
F1 Score
(Recall)
input layer requirements. NasNetLarge pretrained network is
Method
then used for feature extraction and the parameters are
extracted from the prediction layer (often known as the fully
connected layer, layer number 1241) which are then passed to NasNetLarge + SVM 92.9% 92.0% 92.3% 96.0% 92.1%
the support vector machine (SVM) classifier.
Resnet50 86.9% 81.2% 82.8% 91.8% 82.0%
Here are the processes applied in the proposed Hybrid Resnet101 85.0% 80.0% 82.4% 91.0% 81.8%
CNN model for classifying types of pneumonia in a total
sample size of 5000 chest x-ray images [9].
521
Authorized licensed use limited to: International Islamic University Malaysia. Downloaded on July 20,2022 at 06:51:49 UTC from IEEE Xplore. Restrictions apply.
2021 International Conference on Data Analytics for Business and Industry (ICDABI)
As seen in Fig. 3., the confusion matrices below visualize patients and help them make informed decisions in a timely
the performance measurement of the resnet50 and resnet101 manner. It can also aid experts with decision-making.
classification models according to the evaluation metrics used
in this study. The diagonal values in darker shade represent the One of the limitations of this study is the limited number
true positive values which further indicates the results where of datasets used, which is necessarily limited in terms of
sample size. Nonetheless, improvement plans are in place for
the model correctly predicts the true class.
further research into the proposed model’s accuracy and
effectiveness in diagnosing pneumonia traces from chest x-ray
images. We would like to implement some more strategies
such as feature selection algorithms to result in a more
accurate and precise model.
ACKNOWLEDGMENT
We would like to thank the University of Bahrain for
providing a platform for researchers and industry
professionals to share and exchange ideas. We would also like
to thank Data'21 Chairs and Editor's Assistant (EDAS) for
providing support with comments and reviews. The authors
show their gratitude to Dr. Taner Tuncer of Firat University
for further explanation on the different CNN architectures.
REFERENCES
[1] The World Health Organization, "Pneumonia," 2 August 2019.
[Online]. Available: https://www.who.int/news-room/fact-
sheets/detail/pneumonia. [Accessed 12 August 2021].
[2] A. S. A. Z. U. e. a. Khan, "A survey of the recent architectures of deep
convolutional neural networks.," Artif Intell Rev, vol. 53, p. 5455–
5516, 2020.
[3] Z. Y. A. B. A. e. a. Batmaz, "A review on deep learning for
recommender systems: challenges and remedies.," Artif Intell Rev,
vol. 52, p. 1–37, 2019.
[4] E. E. a. T. Aydin, "Detection of Pneumonia with a Novel CNN-based
Approach," Sakarya University Journal of Computer and Information
Sciences, vol. 4, no. 1, pp. 26-34, 30 April 2021.
[5] H.-K. L. Y. X. Guangyu Jia, "Classification of COVID-19 chest X-
Ray and CT images using a type of dynamic CNN modification
method," Computers in Biology and Medicine, vol. 134, 2021.
[6] P. T. S. K. D. G. A. K. J. J. R. Amit Kumar Jaiswal, "Identifying
pneumonia in chest X-rays: A deep learning approach,"
Measurement, vol. 145, pp. 511-518, 2019.
[7] J. G. T. Hou, "Explainable DCNN based chest X-ray image analysis
Fig. 3. Confusion matrix for Resnet50 and Resnet101 and classification for COVID-19 pneumonia detection.," Sci Rep, vol.
11, no. 16071, 2021.
VII. CONCLUSION [8] P. C. P. O. M. e. a. de Sousa, "COVID-19 classification in X-ray chest
images using a new convolutional neural network: CNN-COVID,"
This paper utilizes the convolutional neural network for Res. Biomed. Eng., 2021.
feature extraction from image data. X-rays and their
application are arguably considered as one of the great [9] D. Kermany, K. Zhang and M. Goldbaum, "Labeled Optical
Coherence Tomography (OCT) and Chest X-Ray Images for
discoveries in medical imaging technology in history [13]. In Classification," Mendeley Data, vol. 2, 2018.
simple terms, X-rays can be referred to as light rays. This type
of medical imaging technique captures images of the body, [10] P. Mooney, "Chest X-ray Images (Pneumonia)," Kaggle, 2017.
[Online]. Available:
which often provides useful information. https://www.kaggle.com/paultimothymooney/chest-xray-
This study is centered on using deep learning techniques pneumonia. [Accessed 2 August 2021].
on medical imaging for diagnostics. Focusing on chest x-ray [11] C. Catal, "Performance Evaluation Metrics for Software Fault
images of pneumonia patients. The chest x-ray data used is Prediction Studies," Acta Polytechnica Hungarica , vol. 9, no. 4, 2012.
gotten from a public repository that contains two major types [12] K. M. B. C. G. R. P. R. K. H. S. I. D. I. S. H. Thirumalaraju P,
of pneumonia: Bacterial and Viral pneumonia. The hybrid "Evaluation of deep convolutional neural networks in classifying
model is made up of 1248 layers which were trained to classify human embryo images based on their morphological quality,"
Heliyon, vol. 7, no. 2, 2021.
the x-ray images into 3 classes, Bacterial, Normal and Viral.
The proposed hybrid model observed in this study [13] J. D. Howell, "EARLY CLINICAL USE OF THE X-RAY.,"
outperformed the other pre-trained CNN models used in this Transactions of the American Clinical and Climatological
Association, vol. 127, pp. 341-349, 2016.
research. The model achieved an accuracy level of 92.9%
which further reveals that this hybrid model could be used to
assist clinicians in diagnosing pneumonia conditions from
chest x-rays. From the results seen, we believe the proposed
model could assist clinicians in diagnosing pneumonia
522
Authorized licensed use limited to: International Islamic University Malaysia. Downloaded on July 20,2022 at 06:51:49 UTC from IEEE Xplore. Restrictions apply.