Application of Residual Network Architecture On Covid-19 Chest X-Ray Classification

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Application of Residual Network Architecture on

Covid-19 Chest x-ray Classification


Susanti Rice Novita
Department of Information Systems Department of Information Systems
UIN Sultan Syarif Kasim UIN Sultan Syarif Kasim
Pekanbaru, Indonesia Pekanbaru, Indonesia
11850322156@students.uin-suska.ac.id rice.novita@uin-suska.ac.id

Mustakim Inggih Permana


Department of Information Systems Department of Information Systems
UIN Sultan Syarif Kasim UIN Sultan Syarif Kasim
Pekanbaru, Indonesia Pekanbaru, Indonesia
mustakim@uin-suska.ac.id inggihpermana@uin-suska.ac.id

Abstract — Convolutional Neural Network (CNN) has training process. In this study, Imagenet weights are used on
proven with good performance in the area of feature extraction. Resnet with a number of convolution layers of 50 and 101.
Classification of medical images is often faced with the lack of The bottleneck structure in Resnet-50 and Resnet-101 serves
sufficient amount of data. Therefore, Transfer Learning can be to reduce the computational load due to an increase in
applied to overcome these problems. Chest x-ray data are weight on a deep network [3]. Model training procedures
complex and require deeper layers for specific features. Resnet that can be used include data splitting techniques,
built with deep layers specifically focuses on problems that Optimizers, and minor changes on hyperparameter setting
often occur in high-depth architectures, which are prone to
[4].
decreased accuracy and training errors. Some of the aspects are
able to affect the performance of the model such as the depth of The optimization algorithm used in the training process
convolution layers and training procedures, which include data can affect the speed and performance of deep learning
splitting technique and Optimizers. In this study, the Hold Out predictions [5] Adaptive Moment Estimation (Adam) and
data splitting and k-fold cross validation of 5 folds with Schocastic Gradient Descent (SGD) optimization
Optimizer Adaptive Moment Estimation (Adam) and algorithms are applied to minimize errors during the
Schocastic Gradient Descent (SGD) on the Resnet-50 and training process. The need for generalization speed can be
Resnet-101 architectures. The training procedure was applied
done by Adam Optimizer while SGD excels in
to 15143 Chest x-ray images measuring 224x224 pixels with
parameters epoch 50 and batch size 100. The best value was
convergence speed [6]. The Hold Out data splitting and k-
obtained using k-fold cross validation on Resnet-50 using the fold cross validation is part of the training procedure that
SGD optimizer with 99% accuracy. affects the generalizability of the model used [7].
Research conducted by Narin, et al has implemented the
Keywords — Resnet, Hold out, k-fold cross validation, Adam, Resnet-50 and 101 variants along with other non-residual
SGD. architectures on 7406 Chest x-ray data collected from 3
different sources, using the Adam Optimizer along with 2,
I. INTRODUCTION 5, and 10 folds cross validation and batch size 3, resulted in
Residual Network (Resnet) is a Neural Network Resnet-50 with an accuracy of 96.1%, 99.5% and 99.7%
architecture proposed by He, et al as research on the for each dataset [8]. Research conducted by Haq, et al on 2
correlation between the depth of the network layer with the datasets that have been augmented amounted to 12864,
effectiveness level of a Neural Network. The research came with the distribution of data Hold Out 70:30 resulting in
to the conclusion that a deep and centralized network can lead 95.20% accuracy and 94.87% on Resnet-50 obtained from
to a decrease in accuracy. This problem arises since more and 100 epochs. The Optimizer used is SGD with of 0.0001 as
more layers are added to the network architecture, the higher a learning rate parameter and a batch size of 100 [9].
the possibility of errors during training [1]. Resnet works Hamlili, et al [10] applied the 4-fold cross validation
effectively in overcoming the vanishing gradient and data splitting technique on binary and multi-class
exploding gradient issues [2] . classification using Transfer Learning Resnet-50 on 6173
Resnet performance may vary depending on the type of Chest x-ray datasets. Data augmentation was applied to
dataset and the type of improvisation carried out in the overcome the prediction imbalance. Training process is
carried out in 2 binary classification scenarios and 1 class 3 Fig. 2. Chest x-ray dataset [11]
classification scenario. The accuracy results obtained were
99.9% and 99.8% for binary classification, meanwhile the 3 B. Preprocessing
class classification resulted in 97.3% accuracy. The preprocessing stage consisted of the following
In this study, Transfer Learning was applied to the data procedures of resizing all the images into the same size of
of 15143 Chest x-ray images consisting of 3 classes, 224x224 pixels. In addition, the image size is increased with
namely Covid-19, Normal, and Pneumonia. The a 3x3 zero padding for each edge of the image. This serves to
augmentation process is done in the form of random maintain the original shape of the image when random
cropping. The training procedure was applied to Resnet-50 cropping augmentation is performed. In Deep Learning, the
and Resnet-101 in several scenarios, including using the number of datasets can be multiplied by the augmentation
Adam Optimizer and SGD Optimizer, with data splitting process. For medical datasets such as x-ray images, not all
Hold out and 5-fold cross validation. augmentations can be applied. Geometric augmentation such
II. METHOD as rotation and scaling has the potential to reduce accuracy
[12].
C. Resnet Architecture

Fig. 3. Bottleneck Structure

The depth of the Resnet layer varies, including 18 and


34 which are Resnet 2 blocks and Resnet with a shortcut
connection in the form of Resnet 3 blocks with a depth of 50,
Fig. 1. Research Metodology 101, up to 152 layers which have bottleneck structures. The
concept of a shortcut connection in Resnet works by
A. Collecting Data bypassing one or more layers which is equipped with a
The dataset obtained from Kaggle [11], amounted to Rectified Linear Unit (ReLu) activation function and batch
15143 Chest x-ray data with the labels Normal, Pneumonia, normalization [1]. The process that occurs in Resnet begins
and Covid-19. The dataset used shown in fig 2. with 7x7 convolutions and followed by ReLu activation
process occurs at each of these convolutions. The bottleneck
structure shown in fig 3.
Transfer Learning performs learning on the large
ImageNet dataset and then stores the model as a pre-trained
model for classification of the Chest x-ray dataset. The
Resnet-50 Learning Transfer Layer has 23,521M pre-trained
parameters as well as 53,120 frozen parameters. Meanwhile,
Resnet-101 has 42,513M pre-trained parameters and 105,344
frozen parameters. Furthermore, the classification process is
carried out to the average-pooling layer. In the output layer,
the softmax activation function is used which can be seen in
formula (1).

zj
e
f j (z )=
∑ e zk (1)
k
The calculated neuron index is denoted as j, the A. Training Process
overall index neuron is denoted by k, and z is the neuron
The Resnet-50 and Resnet-101 training procedures use
from the output process. The number of neurons used in the
final classification process is 3 neurons. The workings of two data sharing techniques, namely Hold out and 5-fold
weight transfer and classification on the Chest x-ray dataset cross validation, as well as several hyperparameter settings
can be seen in Figure 4. including 50 epochs, batch size 100, and learning rate
0.00001. Data sharing Hold out divides data with the
formation of 70% : 30% [15], 80% : 20% [16], and 90% :
10% [17] while k-fold cross validation with a total of k=5
[8] equally divides the training dataset into 5 parts
randomly. The training process is carried out using a
Stratified k-fold so that each fold represents a complete
sample of each target class [18]. Based on the training
process carried out on the Adam Optimizer and SGD, the
accuracy results obtained from data sharing with Hold out
and 5-fold cross validation are represented by tables 1, 2, 3
and 4 as well as graphs 6 and 7.

TABLE I. TRAINING RESULT OF ADAM OPTIMIZER ON


RESNET-50
Fig. 4. Transfer Learning [14]
Adam Optimizer Training
Model Data
D. Training Resnet Accuracy Training Time (s)
Splitting
The results of the training process are accuracy and Hold out
0.97
training time. In dividing the data with 5 folds, the accuracy (70:30) 8185
Hold out
of each fold will be obtained. The compared accuracy is the (80:20)
0.85 6450
mean or average accuracy. The best performance is owned Resnet-50
Hold out
0.98 7102
by data splitting and Optimizer with the highest accuracy (90:10)
value and least amount of training time. The block diagram 5-fold cross
validation
0.97 17430
of the training process is described in Fig 5.
TABLE II. TRAINING RESULT OF SGD OPTIMIZER ON RESNET-
50
Sgd Optimizer Training
Model Data
Accuracy Training Time (s)
Splitting
Hold out
(70:30)
0.99 3350
Hold out
(80:20)
0.98 3500
Resnet-50
Hold out
(90:10)
0.98 3650
5-fold cross
validation
0.99 32868

TABLE III. TRAINING RESULT OF ADAM OPTIMIZER ON


RESNET-101

Adam Optimizer Training


Model Data
Accuracy Training Time (s)
Splitting
Hold out
(70:30)
0.98 5100
Hold out
(80:20)
0.99 5501
Resnet-101
Hold out
Fig. 5. Training Process (90:10)
0.99 5850
5-fold cross
0.97 27639
III. RESULT AND DISCUSSION validation

The training process is carried out using Google Colab


with tensorflow, hard, numpy, seaborn, and pandas
libraries. The programming language used is Python 3.
TABLE IV. TRAINING RESULT OF SGD OPTIMIZER ON RESNET-
101 Resnet-101
Sgd Optimizer Training 0.99
Model Data
Accuracy Training Time (s)
Spitting 0.94
Hold out
(70:30)
0.98 12033 0.89
Hold out
(80:20)
0.99 5500
Resnet-101 0.84
Hold out
(90:10)
0.99 5850 0.79
5-fold cross
validation
0.99 33117
0.74
K-Fold Cross 70% : 30% 80% : 20% 90% : 10%
(Fold=5)
Based on the training time values described in Tables 1
and 2, Adam Optimizer spends 40-60 minutes longer Adam SGD
training time on hold out data splitting and 1-4 hours faster
on 5-fold cross validation. A hold out data splitting with Fig. 7. Graph of training accuracy on Resnet-101
80:20 formation using Adam Optimizer on Resnet-50 shows
an indication of an imbalance in data sharing which results in IV. CONCLUSION
low predictive values for the three classes. The resulting
This study applies data splitting techniques of Hold out
accuracy value is 14% smaller than the distribution of Hold
and k-fold cross validation with 5 folds along with Adam
Out data with the same ratio using the SGD Optimizer.
and SGD Optimizers on the Resnet-50 and Resnet-101. The
The data splitting technique using k-fold cross validation experimental results show that Resnet-50 with the k-fold
with 5-folds shows the predicted value at the dataset class cross validation data splitting technique and the SGD
level is more stable, and does not cause a performance Optimizer has the best and most stable accuracy results in
imbalance when the Adam Optimizer is used. The best each class. The training procedure and minor changes to the
accuracy value is obtained on the Resnet-50 architecture hyperparameter settings show a significant difference in
using the SGD Optimizer. The overall comparison of the performance at a more specific level.
accuracy values of each data splitting and Optimizers is
shown in Graphs 6 and 7.
REFERENCES

Resnet-50 [1] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual


0.99
learning for image recognition,” Proc. IEEE
Comput. Soc. Conf. Comput. Vis. Pattern Recognit.,
0.94 vol. 2016-Decem, pp. 770–778, 2016, doi:
10.1109/CVPR.2016.90.
0.89 [2] I. Z. Mukti and D. Biswas, “Transfer Learning Based
Plant Diseases Detection Using ResNet50,” 2019 4th
0.84 Int. Conf. Electr. Inf. Commun. Technol. EICT 2019,
no. December, pp. 1–6, 2019, doi:
0.79
10.1109/EICT48899.2019.9068805.
0.74 [3] Y. H. Kim, J. B. Park, M. S. Chang, J. J. Ryu, W. H.
K-Fold Cross 70% : 30% 80% : 20% 90% : 10% Lim, and S. K. Jung, “Influence of the depth of the
(Fold=5) convolutional neural networks on an artificial
Adam SGD intelligence model for diagnosis of orthognathic
surgery,” J. Pers. Med., vol. 11, no. 5, 2021, doi:
Fig. 6. Graph of training accuracy on Resnet-50 10.3390/jpm11050356.
[4] T. He et al., “Bag of Tricks for Image Classiral
Networks,” Cvpr, pp. 558–567, 2019.
[5] D. Choi, C. J. Shallue, Z. Nado, J. Lee, C. J.
Maddison, and G. E. Dahl, “On Empirical
Comparisons of Optimizers for Deep Learning,” no.
1, 2019, [Online]. Available:
http://arxiv.org/abs/1910.05446.
[6] A. Manickam, J. Jiang, Y. Zhou, A. Sagar, R.
Soundrapandiyan, and R. Dinesh Jackson Samuel,
“Automated pneumonia detection on chest X-ray [13] Q. Zhu, Z. He, T. Zhang, and W. Cui, “Improving
images: A deep learning approach with different classification performance of softmax loss function
optimizers and transfer learning architectures,” based on scalable batch-normalization,” Appl. Sci.,
Meas. J. Int. Meas. Confed., vol. 184, no. November vol. 10, no. 8, pp. 1–8, 2020, doi:
2020, p. 109953, 2021, doi: 10.3390/APP10082950.
10.1016/j.measurement.2021.109953. [14] E. Baykal, H. Dogan, M. E. Ercin, S. Ersoz, and M.
[7] E. Yagis, A. G. S. De Herrera, and L. Citi, Ekinci, “Transfer learning with pre-trained deep
“Generalization Performance of Deep Learning convolutional neural networks for serous cell
Models in Neurodegenerative Disease classification,” Multimed. Tools Appl., vol. 79, no.
Classification,” Proc. - 2019 IEEE Int. Conf. 21–22, pp. 15593–15611, 2020, doi:
Bioinforma. Biomed. BIBM 2019, pp. 1692–1698, 10.1007/s11042-019-07821-9.
2019, doi: 10.1109/BIBM47256.2019.8983088. [15] C. Zhou, J. Song, S. Zhou, Z. Zhang, and J. Xing,
[8] A. Narin, C. Kaya, and Z. Pamuk, “Automatic “COVID-19 Detection based on Image Regrouping
Detection of Coronavirus Disease (COVID-19) and ResNet-SVM using Chest X-ray Images,” IEEE
Using X-ray Images and Deep Convolutional Neural Access, vol. 9, 2021, doi:
Networks,” arXiv Prepr. arXiv2003.10849., 2020, 10.1109/ACCESS.2021.3086229.
[Online]. Available: [16] A. Makris, I. Kontopoulos, and K. Tserpes,
https://arxiv.org/abs/2003.10849. “COVID-19 detection from chest X-ray images
[9] A. U. Haq, J. P. Li, S. Ahmad, and S. Khan, using deep learning and convolutional neural
“Employing Deep Learning and Transfer Learning networks,” ACM Int. Conf. Proceeding Ser., no.
Techniques,” 2021. December 2019, pp. 60–66, 2020, doi:
[10] F. Z. Hamlili, M. Beladgham, M. Khelifi, and A. 10.1145/3411408.3411416.
Bouida, “Transfer learning with Resnet-50 for [17] K. Kc, Z. Yin, M. Wu, and Z. Wu, “Evaluation of
detecting COVID-19 in chest X-ray images,” deep learning-based approaches for COVID-19
Indones. J. Electr. Eng. Comput. Sci., vol. 25, no. 3, classification based on chest X-ray images,” Signal,
pp. 1458–1468, 2022, doi: Image Video Process., vol. 15, no. 5, pp. 959–966,
10.11591/ijeecs.v25.i3.pp1458-1468. 2021, doi: 10.1007/s11760-020-01820-2.
[11] T. Rahman, M. Chowdhurry, and A. Khandakar, [18] P. Schneider, D. Müller, and F. Kramer,
“COVID-19 Radiography Database | Kaggle.” “Classification of Viral Pneumonia X-ray Images
https://www.kaggle.com/datasets/tawsifurrahman/co with the Aucmedi Framework,” no. February, Oct.
vid19-radiography-database (accessed Jul. 06, 2022). 2021, doi: https://doi.org/10.48550.
[12] M. Elgendi et al., “The Effectiveness of Image
Augmentation in Deep Learning Networks for
Detecting COVID-19: A Geometric Transformation
Perspective,” Front. Med., vol. 8, pp. 0–12, 2021,
doi: 10.3389/fmed.2021.629134.

You might also like