KLASIFIKASI PNEUMONIA PADA CITRA X-RAY DADA MENGGUNAKAN EKSTRAKSI CIRI CONVOLUTIONAL NEURAL NETWORK DAN ALGORITMA K-NEAREST NEIGHBOR

Authors

  • Yusraka Dimas Al Iman Program Studi Teknik Biomedis, Sekolah Tinggi Kesehatan Semarang
  • Septine Eka Putri Program Studi Keselamatan dan Kesehatan Kerja, Sekolah Tinggi Kesehatan Semarang
  • Agus Supriyanto Teknik Elektronika, SMK Pembangunan Nasional Purwodadi

DOI:

https://doi.org/10.26623/elektrika.v18i1.14211

Keywords:

citra X-Ray dada, convolutional neural network, K-nearest neighbor, deteksi pneumonia., klasifikasi citra medis

Abstract

Pneumonia is an acute lung infection that remains one of the leading causes of death worldwide, particularly in children under five years of age and the elderly. Conventional diagnosis through chest X-ray interpretation requires high radiological expertise and is susceptible to human error, especially in regions with limited medical resources. This study proposes a two-stage automatic pneumonia classification system using Convolutional Neural Network (CNN) as an automatic feature extractor and K-Nearest Neighbor (KNN) as the final classifier on chest X-ray images. The dataset used is the publicly available Chest X-Ray Images (Pneumonia) from Kaggle, consisting of 5,863 images classified into two classes: Normal (1,583 images) and Pneumonia (4,280 images). The preprocessing pipeline includes grayscale conversion, Contrast Limited Adaptive Histogram Equalization (CLAHE), resizing to 224×224 pixels, and normalization to (0,1). A CNN architecture with three convolutional blocks (32–64–128 filters) with Batch Normalization extracts a 128-dimensional feature vector per image. The optimal K value for KNN is determined through validation experiments yielding K=5 with weighted Euclidean distance. The proposed system achieves an accuracy of 92.80%, precision of 94.12%, recall of 95.34%, F1-Score of 94.73%, specificity of 91.98%, and AUC-ROC of 0.971 on the test set, outperforming conventional methods including SVM+HOG (78.30%) and CNN end-to-end (90.45%).

 

Keywords: chest X-ray, convolutional neural network, K-nearest neighbor, medical image classification, pneumonia detection.

 

ABSTRAK

Pneumonia merupakan infeksi akut pada paru-paru yang masih menjadi salah satu penyebab kematian tertinggi di dunia, terutama pada anak-anak di bawah usia lima tahun dan lansia. Diagnosis konvensional melalui interpretasi citra X-Ray dada memerlukan keahlian radiologis yang tinggi dan rentan terhadap kesalahan manusia, khususnya di daerah dengan keterbatasan sumber daya medis. Penelitian ini mengusulkan sistem klasifikasi pneumonia otomatis dua tahap menggunakan Convolutional Neural Network (CNN) sebagai ekstraktor ciri otomatis dan K-Nearest Neighbor (KNN) sebagai pengklasifikasi akhir pada citra X-Ray dada. Dataset yang digunakan adalah Chest X-Ray Images (Pneumonia) dari Kaggle yang terdiri dari 5.863 citra dengan dua kelas: Normal (1.583 citra) dan Pneumonia (4.280 citra). Pipeline preprocessing meliputi konversi grayscale, peningkatan kontras menggunakan Contrast Limited Adaptive Histogram Equalization (CLAHE), resize ke 224×224 piksel, dan normalisasi ke rentang (0,1). Arsitektur CNN dengan tiga blok konvolusi (32–64–128 filter) disertai Batch Normalization mengekstrak vektor fitur 128 dimensi per citra. Nilai K optimal untuk KNN ditentukan melalui eksperimen validasi menghasilkan K=5 dengan jarak Euclidean berbobot. Sistem yang diusulkan mencapai akurasi 92,80%, presisi 94,12%, recall 95,34%, F1-Score 94,73%, specificity 91,98%, dan AUC-ROC 0,971 pada data uji, mengungguli metode konvensional termasuk SVM+HOG (78,30%) dan CNN end-to-end (90,45%).

References

[1] A. M. Alqudah, H. Alquraan, dan I. A. Qasmieh, "A novel method for multivariant pneumonia classifica-tion based on hybrid CNN-PCA based feature extrac-tion using extreme learning machine with CXR imag-es," Diagnostics, vol. 14, no. 17, hal. 1893, Agu. 2024. Tersedia: https://doi.org/10.3390/diagnostics14171893

[2] E. Ayan dan H. M. Ünver, "Recent advancement of deep learning techniques for pneumonia detection from chest X-ray images: A systematic re-view," Biomedical Signal Processing and Control, vol. 96, hal. 106622, Okt. 2024. Tersedia: https://doi.org/10.1016/j.bspc.2024.106622

[3] A. Narin, C. Kaya, dan Z. Pamuk, "A deep convolution-al neural network for pneumonia detection from chest X-ray images using EfficientNetB0 and Dense-Net121," Diagnostics, vol. 14, no. 4, hal. 392, Feb. 2024. Tersedia: https://doi.org/10.3390/diagnostics14040392

[4] M. A. Khan, M. Sharif, T. Akram, R. Damaševičius, dan R. Maskeliūnas, "Chest X-ray analysis with deep learn-ing-based image analysis models: A systematic re-view," Diagnostics, vol. 13, no. 2, hal. 268, Jan. 2023. Tersedia: https://doi.org/10.3390/diagnostics13020268

[5] P. Dehbozorgi, O. Ryabchykov, dan T. W. Bocklitz, "A comparative study of statistical, radiomics, and deep learning feature extraction techniques for medical im-age classification in optical and radiological modali-ties," Computers in Biology and Medicine, vol. 187, hal. 109768, Mar. 2025. Tersedia: https://doi.org/10.1016/j.compbiomed.2025.109768

[6] P. Sharma, A. Choudhary, R. Gupta, A. Sharma, S. Agarwal, dan S. Sharma, "Pneumonia detection in chest X-rays using transfer learning and CNN with KNN clas-sification achieving 92.80% testing accuracy," da-lam Proc. IEEE Int. Conf. Medical Imaging and Com-puter-Aided Diagnosis (MICAD), 2023, hal. 45–52. Tersedia: https://doi.org/10.1109/MICAD.2023.10463235

[7] L. Jena, S. K. Behera, S. Dash, dan P. K. Sethy, "Deep feature extraction and fine κ-nearest neighbour for en-hanced human papillomavirus detection in cervical cancer: a comprehensive analysis of colposcopy imag-es," Contemporary Oncology (Poznan), vol. 28, no. 1, hal. 37–44, Apr. 2024. Tersedia: https://doi.org/10.5114/wo.2024.139091

[8] Y. D. Al Iman, R. R. Isnanto, dan O. D. Nurhayati, "Klasifikasi jenis ikan laut K-Nearest Neighbor ber-dasarkan ekstraksi ciri 2-Dimensional Linear Discrimi-nant Analysis," Jurnal Teknologi Informasi dan Ilmu Komputer (JTIIK), vol. 10, no. 4, hal. 919–926, Agu. 2023. Tersedia: https://doi.org/10.25126/jtiik2023106767

[9] D. S. Kermany, M. Goldbaum, W. Cai, C. C. S. Valen-tim, H. Liang, S. L. Baxter, A. McKeown, G. Yang, X. Wu, F. Yan, J. Dong, M. K. Prasadha, J. Pei, M. Y. L. Ting, J. Zhu, C. Li, S. Hewett, J. Dong, I. Ziyar, A. Shi, R. Zhang, L. Zheng, R. Hou, W. Shi, X. Fu, Y. Duan, V. A. N. Huu, C. Wen, E. D. Zhang, C. L. Zhang, O. Li, X. Wang, M. A. Singer, X. Sun, J. Xu, A. Tafreshi, M. A. Lewis, H. Xia, dan K. Zhang, "Identifying medical di-agnoses and treatable diseases by image-based deep learning," Cell, vol. 172, no. 5, hal. 1122–1131.e9, Feb. 2018. Tersedia: https://doi.org/10.1016/j.cell.2018.02.010

[10] V. Chouhan, S. K. Singh, A. Khamparia, D. Gupta, P. Tiwari, C. Moreira, R. Damaševičius, dan V. H. C. de Albuquerque, "A novel transfer learning based ap-proach for pneumonia detection in chest X-ray imag-es," Applied Sciences, vol. 10, no. 2, hal. 559, Jan. 2020. Tersedia: https://doi.org/10.3390/app10020559

[11] A. Mittal, D. Kumar, dan M. Mittal, "Pneumonia dis-ease detection using chest X-rays and machine learning with CLAHE preprocessing," Algorithms, vol. 18, no. 2, hal. 82, Feb. 2025. Tersedia: https://doi.org/10.3390/a18020082

[12] G. Liang dan L. Zheng, "A transfer learning method with deep residual network for pediatric pneumonia di-agnosis," Computer Methods and Programs in Biomed-icine, vol. 187, hal. 104964, Apr. 2020. Tersedia: https://doi.org/10.1016/j.cmpb.2019.104964

[13] P. K. Sethy, S. K. Behera, P. K. Ratha, dan P. Biswas, "A deep learning based scalable and adaptive feature ex-traction approach for medical image analy-sis," Information Systems Frontiers, vol. 25, no. 6, hal. 2287–2302, Des. 2023. Tersedia: https://doi.org/10.1007/s10796-023-10391-9

[14] P. K. Sethy, N. Kannan, S. K. Behera, dan S. Sahu, "Deep feature extraction and classification of diabetic retinopathy using ResNet101 and K-nearest neighbor classifier," Engineering, Technology & Applied Sci-ence Research (ETASR), vol. 14, no. 4, hal. 15412–15418, Agu. 2024. Tersedia: https://doi.org/10.48084/etasr.10188

[15] H. Guo, X. Li, J. Zhuang, T. Liu, L. Zhu, D. Wang, L. Lin, dan T. Xu, "A deep learning system for detecting diabetic retinopathy across the disease spectrum with CLAHE-based preprocessing enhancement," Nature Communications, vol. 13, no. 1, hal. 4358, Jul. 2022. Tersedia: https://doi.org/10.1038/s41467-022-32148-3

[16] X. Wang, Y. Peng, L. Lu, Z. Lu, M. Bagheri, dan R. M. Summers, "ChestX-ray14: Hospital-scale chest X-ray database and benchmarks for weakly-supervised classi-fication and localization of common thorax diseases," dalam Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 2017, hal. 3462–3471. Tersedia: https://doi.org/10.1109/CVPR.2017.369

[17] A. Supriyanto, R. R. Isnanto, dan O. D. Nurha-yati, “Klasifikasi penyakit daun kopi robusta menggunakan metode SVM dengan ekstraksi ciri GLCM”, Jurnal Nasional Teknik Elektro dan Teknologi Informasi, vol. 12, no. 4, hal. 241-248, Nov. 2023. Tersedia: https://doi.org/10.22146/jnteti.v12i4.8044

Published

2026-04-28

Issue

Section

Articles

How to Cite

Al Iman, Y. D., Putri, S. E., & Supriyanto, A. (2026). KLASIFIKASI PNEUMONIA PADA CITRA X-RAY DADA MENGGUNAKAN EKSTRAKSI CIRI CONVOLUTIONAL NEURAL NETWORK DAN ALGORITMA K-NEAREST NEIGHBOR. Elektrika, 18(1), 31-39. https://doi.org/10.26623/elektrika.v18i1.14211