Classification of Tuberculosis and Pneumonia in Human Lung Based on Chest X-Ray Image Using Convolutional Neural Network

Muhaza Liebenlito, Yanne Irene, Abdul Hamid



In this paper, we use chest x-ray images of Tuberculosis and Pneumonia to diagnose the patient using a convolutional neural network model. We use 4273 images of pneumonia, 1989 images of normal, and 394 images of tuberculosis. The data are divided into 80% as the training set and 20% as the testing set. We do the preprocessing steps to all of our images data, such as resize, converting RGB to grayscale, and Gaussian normalization. On the training dataset, the sampling technique used is undersampling and oversampling to balance each class. The best model was chosen based on the Area under Curve value i.e. the area under the curve of Receiver Operating Characteristics. This method shows that the best model obtains when trains the training dataset using oversampling. The Area under Curve value is 0.99 for tuberculosis and 0.98 for pneumonia. Therefore, this best model succeeds to identify 86% true for tuberculosis and 96% true for pneumonia.

Keywords: chest X-ray images; tuberculosis; pneumonia; convolutional neural network.                                                               



Pada penelitian ini memanfaatkan data citra chest x-ray penderita penyakit tuberculosis dan pneumonia. Model convolutional neural network digunakan untuk membantu mendiagnosis kedua penyakit ini. Data yang digunakan masing-masing sudah dilabeli sebanyak 4273 citra pneumonia, 1989 citra normal dan 394 citra tuberculosis. Data tersebut dibagi menjadi 80% himpunan data latih dan 20% data uji. Himpunan data tersebut telah melalui 3 tahap prepocessing yaitu resize citra, merubah citra RGB menjadi grayscale dan standarisasi gausian pada citra. Pada data latih dilakukan teknik sampling berupa undersampling dan oversampling data untuk menyeimbangkan data latih antar kelas. Model terbaik dipilih berdasarkan nilai Area under Curve yaitu luas daerah di bawah kurva Receiver Operating Chracteristics. Hasil menunjukkan bahwa model terbaik dihasilkan ketika dilatih menggunakan data latih hasil oversampling dengan nilai Area under Curve kelas tuberculosis sebesar 0,99 dan nilai Area under Curve kelas pneumonia sebesar 0,98. Oleh karena itu, model terbaik ini mampu mengindentifikasi sebanyak 86% penyakit tuberculosis dan 96% penyakit pneumonia.

Kata Kunci: citra chest X-ray; penyakit infeksi paru; pengolahan citra digital Convolutional Neural Network.


Chest X-Ray Images; Lung Infection Disease; Image Processing; Convolutional Neural Network


“Tuberculosis.” [Online]. Available: [Accessed: 08-Jul-2019].

“Pneumonia.” [Online]. Available: [Accessed: 08-Jul-2019].

C. Qin, D. Yao, Y. Shi, dan Z. Song, “Computer-Aided Detection in Chest Radiography Based on Artificial Intelligence: A Survey,” BioMedical Engineering Online, vol. 17, no. 1, pp. 1–23, 2018. 10.1186/s12938

A. M. Schilham, B. van Ginneken, dan M. Loog, “A Computer-Aided Diagnosis System for Detection of Lung Nodules in Chest Radiographs with An Evaluation on A Public Database,” Medical Image Analysis, vol. 10, no. 2, pp. 247–258, 2006.

J. H. Tan, U. R. Acharya, C. Tan, K. T. Abraham, dan C. M. Lim, “Computer-Assisted Diagnosis of Tuberculosis: A First Order Statistical Approach to Chest Radiograph,” Journal of Medical Systems, vol. 36, no. 5, pp. 2751–2759, Oktober. 2012.

S. Hwang, H.-E. Kim, J. Jeong, dan H.-J. Kim, “A Novel Approach for Tuberculosis Screening Based on Deep Convolutional Neural Networks,” In: Medical imaging 2016: computer-aided diagnosis, Vol. 9785, San Diego: SPIE; 2016.

Y. Bar, I. Diamant, L. Wolf, dan H. Greenspan, “Deep Learning with Non-Medical Training Used for Chest Pathology Identification,” In: SPIE medical imaging; Orlando, Florida, United States. SPIE; 2015. pp. 7. 10.1117/12.2083124.

R. H. Abiyev dan M. K. S. Ma’aitah, “Deep Convolutional Neural Networks for Chest Diseases Detection,” Journal of Healthcare Engineering, vol. 2018, Article ID 4168538, 2018. Available: [Accessed: 31-Jul-2019].

M.Paul, “Chest X-Ray Images (Pneumonia) | Kaggle.” [Online]. Available: [Accessed: 31-Jul-2019].

M.Kevin, “TBC.” [Online]. Available:

D. S. Kermany, K. Zhang, dan M. H. Goldbaum, “Labeled Optical Coherence Tomography (OCT) and Chest X-Ray Images for Classification,” Mendeley data 2, 2018.

D. S. Kermany et al., “Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning.,” Cell, vol. 172, no. 5, pp. 1122-1131.e9, Feb. 2018.

S. Jaeger, S. Candemir, S. Antani, Y.-X. J. Wáng, P.-X. Lu, dan G. Thoma, “Two Public Chest X-Ray Datasets for Computer-Aided Screening of Pulmonary Diseases,” Quantitative Imaging in Medicine and Surgery, vol. 4, no. 6, pp. 475–7, Dec. 2014.

Y. Zhao, Z. S.-Y. Wong, dan K. L. Tsui, “A Framework of Rebalancing Imbalanced Healthcare Data for Rare Events’ Classification: A Case of Look-Alike Sound-Alike Mix-Up Incident Detection,” Journal of Healthcare Engineering, vol. 2018, p. 6275435, 2018.

Full Text: PDF

DOI: 10.15408/inprime.v2i1.14545


  • There are currently no refbacks.