A_ResNet_Based_Pneumonia_Classification_Algorithm_for_Chest_X-Ray_Images
A_ResNet_Based_Pneumonia_Classification_Algorithm_for_Chest_X-Ray_Images
Abstract—X-ray examination is an effective and reliable computer-aided diagnosis systems have gradually been
method for early detection and diagnosis of pneumonia, because introduced into clinical practice, providing reference opinions
the spatial structure of human lung organs presented by for radiologists in interpreting X-ray images. Various methods
pneumonia X-ray images is complex and the gray scale have been proposed by scholars worldwide to address the
distribution is uneven, and it will take a lot of manpower and automatic recognition of pneumonia X-ray images. Stokes et
time to identify pneumonia X-ray images. This study proposes a al. [4] utilized logistic regression[5], decision trees[6], and
resNet based pneumonia classification algorithm for chest x-ray support vector machines (SVM)[7] to classify patients’
images. The upgraded ResNet-18 model is trained and clinical information into pneumonia or bronchitis categories.
developed on the chest X-ray 2017 dataset. In this study, the
Among these, decision trees achieved the highest accuracy
original normalization method Batch Normalization (BN) in the
ResNet-18 model is replaced with Layer Normalization (LN) to
and F1 score, reaching 84% and 87%, respectively. Decision
mitigate the drawbacks of BN affected by Batch Size. trees are commonly used in machine learning for classification
Furthermore, the activation function ReLu is substituted with tasks. Their advantages include simplicity, ease of
Leaky ReLu to prevent the complete death of negative weights, understanding, and the ability to handle non-linear
retaining some negative weights and thus constructing an relationships. However, they can be prone to overfitting when
improved ResNet-18 model. Finally, a three-fold cross- the tree structure is too complex, and when dealing with
validation method is adopted, where 67% of the data is used for imbalanced data, decision trees may tend to bias towards the
training and 33% for testing. The performance of the proposed majority class, affecting predictive performance. Shao [3] also
improved ResNet-18 model is evaluated on the test data, utilized SVM algorithm for classifying Community Acquired
demonstrating superior binary classification performance Pneumonia (CAP) in children, achieving a good accuracy rate
compared to the unimproved ResNet-18 and other benchmark of 90% in early diagnosis. SVM, as a powerful supervised
models (including AlexNet, DenseNet-121, MobileNet-V2, and learning model, addresses many linearly inseparable problems
VGG-16), with accuracy, precision, recall, Kappa, and F1 score through high-dimensional mapping, with low generalization
values of 91.14%, 87.38%, 91.85%, 78.34%, and 89.13%, error. However, in cases with a large number of samples, SVM
respectively. These results indicate that the improved ResNet-18 training time can be lengthy, and parameter tuning complexity
model can better classify pneumonia X-ray images, reducing may compromise robustness and accuracy. Sharma et al. [8]
diagnosis time for doctors and conserving medical resources.
utilized the VGG-16 deep learning model to detect and
Keywords—Pneumonia Classification, ResNet-18, Leaky
classify pneumonia in chest X-ray (CXR) image datasets.
ReLu, Layer Normalization Compared to Stokes et al.’s standalone use of support vector
machines, VGG-16 achieved approximately a 9%
I. INTRODUCTION improvement in accuracy and a 6% improvement in F1 score.
In recent years, Deep Learning has emerged in the field of
Pneumonia, as a common respiratory disease that poses a
artificial intelligence, with a plethora of methods, notably
threat to human health, is particularly prevalent among infants
Convolutional Neural Network (CNN) [9], leading the way.
and young children aged zero to five years old and elderly
Wang et al. employed a DenseNet network model with
individuals aged 65 and above. Its mortality rate is increasing
attention mechanisms to perform binary classification on the
annually, highlighting the necessity for early diagnosis and
chest X-ray 2017 dataset. Kong et al. [10] proposed a method
intervention. [1, 2] According to the World Health
for chest X-ray image classification based on feature fusion of
Organization, in 2015 alone, pneumonia led to the deaths of
DenseNet and VGG16, achieving both binary and ternary
0.92 million children, accounting for 16% of deaths among
classification on chest X-ray image datasets. A. M. Rifai et al.
children under the age of five worldwide. From 2020 to 2023,
[11] employed MobileNetV2 and image augmentation
the world experienced a global pneumonia epidemic caused
techniques to differentiate pneumonia and non-pneumonia
by the novel coronavirus (COVID-19). It can be seen that
cases in chest X-ray images. The aforementioned studies
pneumonia poses a serious threat to the lives and health of
failed to consider feature degradation and convergence
people all over the world, so rapid diagnosis of pneumonia has
efficiency during model training. Additionally, they did not
become a necessity.
fully exploit the classification performance of the models
In traditional pneumonia diagnosis, the interpretation of when data is limited and distribution is imbalanced.
pneumonia lesion images heavily relies on experienced
According to relevant studies[12], ResNet-18 has slightly
physicians, yet the accuracy is not guaranteed due to
lower accuracy than ResNet-34, ResNet-50 and ResNet-101,
differences in individual expertise. [4] With the advancement
but its network parameters are fewer, which is easier to
of computer and digital image processing technologies,
converge and faster to inference. In this study, we pretrained
1589
Authorized licensed use limited to: UNIVERSITY PUTRA MALAYSIA. Downloaded on January 20,2025 at 15:47:56 UTC from IEEE Xplore. Restrictions apply.
Leaky ReLu mitigates neuron death by introducing a small
slope for negative inputs, ensuring that negative values are not
entirely suppressed and can capture relevant features better.
Additionally, the slope of Leaky ReLu is a learnable
parameter, optimized during training to adapt the model to
data features. Hence, compared to ReLu, Leaky ReLu is more
suitable for our study’s data. The diagrams above illustrate the
improved residual blocks with stride 1 and stride 2, where C
represents the number of convolutional filters. We added a
1×1 pointwise convolution when the stride is 2 to maintain
dimensionality equality when adding residual structures.
Below are the formulas for LN and Leaky ReLu:
x−μ
LN(x) = γ⨀ +β (1)
�σ2 +ϵ
1590
Authorized licensed use limited to: UNIVERSITY PUTRA MALAYSIA. Downloaded on January 20,2025 at 15:47:56 UTC from IEEE Xplore. Restrictions apply.
Where, TP=True Positive TN=True Negative FP=False D. Comparison of Improved ResNet-18
Positive FN=False Negative
TABLE IV COMPARISON OF THE IMPROVED RESNET18 MODEL WITH OTHER
Here, TP represents the correctly predicted pneumonia MODELS
cases, TN represents the correctly predicted normal cases, FP
F1-
represents the erroneously predicted pneumonia cases, and FN Models Accuracy Recall Precision Kappa
Score
represents the erroneously predicted normal cases. AlexNet[23] 84.55% / / / 74.58%
DenseNet121[24] 88.52% 92.03% 84.28% 72.62% 86.21%
C. Effectiveness of Improved ResNet-18 VGG16[23] 80.22% / / / 71.20%
MobileNetV2[25] 90.22% 90.22% 90.33% / 90.26%
TABLE I COMPARISON OF DIFFERENT NORMALIZATION METHODS Improved
91.14% 91.85% 87.38% 78.34% 89.13%
ResNet18
Nomalizition F1-
Accuracy Recall Precision Kappa
Methods Score We trained models using AlexNet, DenseNet121, VGG16,
LN 87.00% 87.76% 82.60% 68.99% 84.38% and MobileNetV2, and compared them with the improved
IN 86.75% 87.52% 82.24 68.39 84.08% ResNet-18 model. All evaluation metrics were higher than
GN 85.91% 87.34% 81.45% 66.93% 83.30%
BN 86.94% 87.72% 82.48% 68.82% 84.30%
those of other models. As indicated in the Table IV, compared
to the AlexNet model, the improved model achieved an
TABLE II COMPARISON OF DIFFERENT ACTIVATION FUNCTION METHODS
increase in accuracy, precision, recall, Kappa, and F1-score by
1.43%, 0.44%, 1.53%, 2.68%, and 1.91%, respectively.
Activation F1- Compared to DenseNet121, the improvements were 2.60%,
Accuracy Recall Precision Kappa
Functions Score 2.1%, 3.10%, 5.72%, and 3.01%. Compared to the VGG16
Leaky
ReLu
87.00% 88.03% 82.65% 69.15% 84.45% model, the improvements were 1.32%, 0.41%, 1.64%, 2.63%,
ELu 86.31% 87.88% 83.78% 67.89% 81.88% and 1.36%. Finally, compared to MobileNetV2, the
PReLu 86.75% 87.47% 82.41% 68.47% 84.10% improvements were 3.43%, 2.44%, 3.96%, 7.30%, and 3.74%.
ReLu 86.94% 87.72% 82.48% 68.82% 84.30% It is evident that the residual connections in the ResNet
network simplify the training process by addressing gradient
We compared the experimental results of ResNet-18 using vanishing and training difficulty issues. Additionally,
four different activation functions and four different improvements in activation functions and normalization
normalization methods to select the best performing activation methods in the model facilitate better generalization to unseen
function to avoid negative parts being directly 0 and the most data. Furthermore, by resolving the Dead ReLU problem, the
efficient normalization method to avoid being affected by flow of gradients is enhanced, making it easier for the model
batch size. This comparison aimed to select the most effective to learn patterns and features from the data.
activation function to prevent the direct suppression of
negative values and choose the best performing normalization IV. CONCLUSION
method to avoid being influenced by the batch size. As shown
in the Table I and Table II, among the various activation Due to the complexity of pneumonia X-ray images, with
functions, compared to the ReLu originally used in the overlapping shadows, manual classification is challenging,
ResNet-18 model, LeakyReLu improved the accuracy, severely impacting the accuracy of classification. Therefore,
precision, recall, Kappa, and F1-score by 0.06%, 0.17%, we proposed a pneumonia classification method using
0.31%, 0.33%, and 0.15%, respectively. Among the various ResNet-18. This method replaces the ReLu activation function
normalization methods, compared to the originally used BN, in ResNet-18 with Leaky ReLu to prevent neuron death during
LN improved the accuracy, precision, recall, Kappa, and F1- model training, thereby improving the model’s generalization
score by 0.06%, 0.12%, 0.04%, 0.17%, and 0.08%, ability. Additionally, LN is used instead of BN in ResNet-18
respectively. Among the different activation functions and to avoid the model’s performance being influenced by batch
normalization methods, Leaky ReLu and LN demonstrated size, enhancing the model’s classification performance.
the best performance in enhancing model performance. Finally, our experimental results are as follows: the accuracy,
Therefore, we selected Leaky ReLu and LN as the activation precision, recall, Kappa, and F1-score of the model are
function and normalization method, respectively, for our 91.14%, 87.38%, 91.85%, 78.34%, and 89.13%, respectively.
improved model. Compared to the ResNet-18 model, there are respective
improvements of 2.39%, 1.1%, 2.73%, 4.82%, and 2.5%.
TABLE III COMPARISON OF RESNET18 MODEL WITH THE IMPROVED Compared to other models we selected (AlexNet,
RESNET18 MODEL DenseNet121, VGG16, and MobileNetV2), there is also a
certain improvement. However, despite the use of residual
F1-
Models Accuracy Recall Precision Kappa
Score connections to enhance model generalization performance,
ResNet-18 88.75% 90.75% 84.65% 73.52% 86.63% the model may still overfit due to insufficient data. Therefore,
Improved this method has a deficiency in solving the problem of
91.14% 91.85% 87.38% 78.34% 89.13%
ResNet-18 overfitting. Avoiding overfitting is a core task in classifier
The separate improvements to the activation function and design, and we hope to explore better methods to improve
normalization method in the original ResNet-18 model led to classifier generalization performance in future research.
slight enhancements in model performance. However, when
these two improvements were combined, the performance of ACKNOWLEDGMENTS
the improved ResNet-18 model was significantly better. As Thanks to the teacher’s guidance and my hard work.
shown in the Table III, compared to the original ResNet-18
model, the improved ResNet-18 model achieved an increase REFERENCES
in accuracy, precision, recall, Kappa, and F1-score by 2.39%, [1] Vianna V P .Study and development of a Computer-Aided Diagnosis
2.73%, 1.1%, 4.82%, and 2.5%, respectively. system for classification of chest x-ray images using convolutional
neural networks pre-trained for ImageNet and data augmentation[J].
1591
Authorized licensed use limited to: UNIVERSITY PUTRA MALAYSIA. Downloaded on January 20,2025 at 15:47:56 UTC from IEEE Xplore. Restrictions apply.
2018. DOI:10.48550/arXiv.1806.00839. Science and Information
[2] Ha P N , Doucet A , Tran G S .Vision Transformer for Pneumonia Technology.2020.DOI:10.1145/3414274.3414496.
Classification in X-ray Images[J]. Proceedings of the 2023 8th [14] Kevisino K , Bam B S , Arambam N . Flower pollination-enhanced
International Conference on Intelligent Information Technology, CNN for lung disease diagnosis[J].The Computer Journal,
2023.DOI:10.1145/3591569.3591602. 2024.DOI:10.1093/comjnl/bxae071.
[3] Kar S , Siddiqui F H , Akhtar N .An Improved CNN-Based Feature [15] Ahamed M A , Chen J , Imran A ,et al. FFCL: Forward-Forward
Extraction Algorithm for Identifying Pneumonia from Chest X-Ray Contrastive Learning for Improved Medical Image Classification[J].
Images[C]//International Conference on Intelligent Computing & 2023.
Optimization. Springer, Cham, 2023.DOI:10.1007/978-3-031-19958- [16] Lakshmi M , Das R , Manohar B . A new COVID-19 classification
5_48. approach based on Bayesian optimization SVM kernel using chest X-
[4] Pradhan A K , Mishra D , Das K ,et al. A COVID-19 X-ray image ray datasets[J]. Evolving Systems, 2024, 15(4):1521-1540.
classification model based on an enhanced convolutional neural DOI:10.1007/s12530-024-09575-8.
network and hill climbing algorithms[J]. Multimedia tools and [17] Li Y , Zhang L , Yu H ,et al. A comprehensive segmentation of chest
applications, 2023. X-ray improves deep learning–based WHO radiologically confirmed
[5] Hamal S , Mishra B K , Baldock R ,et al. A comparative analysis of pneumonia diagnosis in children[J]. European Radiology, 2024,
machine learning algorithms for detecting COVID-19 using lung X-ray 34(5):3471-3482.DOI:10.1007/s00330-023-10367-y.
images[J]. Decision Analytics Journal, 2024, [18] Pal M , Parija S , Panda G . An effective ensemble approach for
11.DOI:10.1016/j.dajour.2024.100460. classification of chest X-ray images having symptoms of COVID: A
[6] Nayak S R , Nayak J , Satapathy G S C .An Automated Lightweight precautionary measure for the COVID-19 subvariants[J]. e-Prime -
Deep Neural Network for Diagnosis of COVID?19 from Chest X-ray Advances in Electrical Engineering, Electronics and Energy, 2024,
Images[J].Arabian journal for science and engineering, 2023, 8.DOI:10.1016/j.prime.2024.100547.
48(8):11085-11102. [19] Rabbah J , Ridouani M , Hassouni L . A New Classification Model
[7] Showkat S , Qureshi S .Efficacy of Transfer Learning-based ResNet Based on Transfer Learning of DCNN and Stacknet for Fast
models in Chest X-ray image classification for detecting COVID-19 Classification of Pneumonia Through X-Ray Images[J]. International
Pneumonia[J].Chemometrics and Intelligent Laboratory Systems, 2022, Journal of Reliable and Quality E-Healthcare,
224:104534-.DOI:10.1016/j.chemolab.2022.104534. 2023.DOI:10.4018/ijrqeh.326765.
[8] El-Dahshan E S A , Bassiouni M M , Hagag A ,et al. [20] Huang H, Ma L . Automatic detection of coronavirus disease (COVID-
RESCOVIDTCNnet: A residual neural network-based framework for 19) in X-ray images using transfer learning[J]. Journal of Intelligent &
COVID-19 detection using TCN and EWT with chest X-ray images[J]. Fuzzy Systems: Applications in Engineering and Technology, 2023,
Expert systems with applications, 2022, 45(5):8135-8144.
204:117410.DOI:10.1016/j.eswa.2022.117410. [21] Ravi V, Narasimhan H , Pham T D . A cost-sensitive deep learning-
[9] Gupta R K , Sahu Y , Kunhare N ,et al. Deep Learning Based based meta-classifier for pediatric pneumonia classification using chest
Mathematical Model for Feature Extraction to Detect Corona Virus X-rays[J]. Expert systems: The international journal of knowledge
Disease using Chest X-ray Images[J].International journal of engineering, 2022(7):39.
uncertainty, fuzziness and knowledge-based systems: IJUFKS, [22] Nillmani, Jain P K, Sharma N, et al. Four Types of Multiclass
2021(6):29.DOI:10.1142/S0218488521500410. Frameworks for Pneumonia Classification and Its Validation in X-ray
[10] Driss M , Koubaa A , Atitallah S B ,et al. Fusion of convolutional Scans Using Seven Types of Deep Learning Artificial Intelligence
neural networks based on Dempster – Shafer theory for automatic Models[J].Diagnostics (Basel, Switzerland), 2022,
pneumonia detection from chest X ‐ ray images[J].International 12(3).DOI:10.3390/diagnostics12030652.
Journal of Imaging Systems and Technology, 2022, 32(2):658- [23] Kaur R P, Sharma A, Singh I ,et al. Deep Learning-Based Pneumonia
672.DOI:10.1002/ima.22653. Recognition from Chest X-Ray Images[J]. International Journal of
[11] Alasasfeh H O , Alomari T , Ibbini M S .Deep Learning Approach for Performability Engineering, 2022(5):18.
COVID-19 Detection Based on X-Ray Images[J]. 2021. [24] Menaouer B, Zoulikha D, El-Houda K N ,et al. Coronavirus Pneumonia
DOI:10.1109/SSD52085.2021.9429383. Classification Using X-Ray and CT Scan Images With Deep
[12] Ismail M M B , Alsumairi S . X-Ray Image based Pneumonia Convolutional Neural Network Models[J]. Journal of information
Classification using Convolutional Neural Networks[J]. Association of technology research, 2022.
Computer, Communication and Education for National Triumph Social [25] Fan R, Bu S .Transfer-Learning-Based Approach for the Diagnosis of
and Welfare Society (ACCENTS), 2020(20). Lung Diseases from Chest X-ray Images[J]. Entropy, 2022,
DOI:10.19101/TIPCV.2020.618050. 24.DOI:10.3390/e24030313.
[13] Phankokkruad M .COVID-19 Pneumonia Detection in Chest X-ray
Images Using Transfer Learning of Convolutional Neural
Networks[C]//DSIT 2020: 2020 3rd International Conference on Data
1592
Authorized licensed use limited to: UNIVERSITY PUTRA MALAYSIA. Downloaded on January 20,2025 at 15:47:56 UTC from IEEE Xplore. Restrictions apply.