Performance Analysis of Different Convolutional Neural Network (CNN) Models with Optimizers in Detecting Tuberculosis (TB) from Various Chest X-ray Images


  •   Salman F. Rabby

  •   Anamul Hasan

  •   Md. Janibul A. Soeb

  •   Gourob P. Shirsho

  •   Bijoy Talukdar


Tuberculosis (TB) is one of the top 10 infectious disease-related deaths. This paper uses Convolutional Neural Networks (CNN) to investigate the accuracy and performance of three pre-trained models with different optimizers and loss functions to diagnose tuberculosis based on the patient's chest X-ray scans. The odds of treating and curing tuberculosis (TB) are better if the disease is diagnosed early in a patient. Early detection of tuberculosis could lead to a decreased overall mortality rate. The best and quickest way to identify tuberculosis is to look at the patient's chest X-Ray image (CXR). A qualified professional Radiologist is required to make an accurate diagnosis. But do not have qualified doctor or radiologist everywhere. On the other hand, it is quite difficult for a doctor or radiologist to diagnose from any x-ray images with open eyes. 914 normal chest x-ray images and 892 TB infected images were used from different sources to train and evaluate these images to detect the exact x-ray of Tuberculosis infected people. Different famous pre-trained models like VGG16, InceptionV3 and Xception etc. were applied. Approximately 80% of the data was used for training and the remaining 20% was used for validation. From all of these datasets, randomly 190 images from normal and 180 images from TB chest x-ray images have been taken. Those randomized 370 (190 for TB and 180 for normal) images were used to evaluate the data finally. Performance of different algorithm like VGG16, InceptionV3 and Xception by applying different optimizers (Adam, Adadelta, Adagrad, Adamax, RMSprop, Nadam, SGD), different loss functions (Binary Cross Entropy, Hinge, Squared Hinge), varying input image size and also varying batch size were also been recorded. Note that, huge variations of performance for different combinations of algorithm, optimizer, loss function, input image size, batch size have been observed. Confusion matrix, precision, recall, f1-score value have also been recorded to understand and justify how accurately the model is predicting the disease from different angles.

Keywords: chest x-ray, pre-trained CNN, tuberculosis.


World Health Organization. Tuberculosis (TB) [Internet]. 14 October 2021. [Accessed 14 December 2021]. Available from:

The Allied Chambers, The Chambers Dictionary, New Delhi: The Allied Chambers India Limited, 1998, p. 352.

Mandell GL. Mandell, Douglas, and Bennett’s Principles and Practice of Infectious Diseases. 7th ed. Philadelphia, PA: Churchill Livingstone; 2010, p. 250.

CDC. Basic TB facts, Centers for Disease Control and Prevention, [Internet]. 13 March 2012. [Accessed 14 March 2021]. Available from:

Konstantinos A. Testing for tuberculosis. Australian Prescriber. 2010;33(1):12-18.

Gibson PG, Abramson M, Wood-Baker R, Volmink J, Hensley M, Costabel U. Evidence-Based Respiratory Medicine, BMJ Books, 2005.

Nayak-Surajit BA. Mantoux test and its interpretation. Indian Dermatology Online Journal. 2012;3(1):2-6.

CDC. Tuberculosis (TB), Centers for Disease Control and Prevention. [Internet]. 8 March 2021. [Accessed 15 December 2021]. Available from:

Mayoclinic Org. Tuberculosis. 3 April 2021. [Internet]. [Accessed 15 December 2021] Available:

World Health Organization. Global tuberculosis report 2021: executive summary. Geneva, Switzerland, 2021.

Miotto R, Wang F, Wang S, Jiang X, Dudley JT. Deep learning for healthcare: review, opportunities and challenges. Briefings in Bioinformatics. 2018;19(6):1236-1246.

Long M. Deep learning in healthcare – How it’s changing the game, Aidoc, 2020. [Internet]. [Accessed 15 December 2021] Available:

Albawi S, Mohammed TA, Al-Zawi S. Understanding of a convolutional neural network, in IEEE, Antalya, Turkey, 2017.

Ahsan M, Gomes R, Denton A. Application of a Convolutional Neural Network using transfer learning for tuberculosis detection. IEEE International Conference on Electro Information Technology (EIT); 2019.

Hooda R, Sofat S, Kaur S, Mittal A, Meriaudeau F. Deep-learning: A potential method for tuberculosis detection using chest radiography. IEEE International Conference on Signal and Image Processing Applications (ICSIPA);2017; Malaysia.

Liu C, Cao Y, Alcantara M, Liu B, Brunette M, Peinado J, Curioso W. TX-CNN: Detecting tuberculosis in chest X-ray images using convolutional neural network. IEEE international conference on image processing (ICIP);2017; Beijing, China.

Oloko-Oba SVM. Diagnosing Tuberculosis Using Deep Convolutional Neural Network. International Conference on Image and Signal Processing, Cham; 2020.

Lopes JVUK. Pre-trained convolutional neural networks as feature extractors for tuberculosis detection. Computers in Biology and Medicine, 2017;89:135-143.

Norval MWZSY. Pulmonary tuberculosis detection using deep learning convolutional neural networks. Proceedings of the 3rd International Conference on Video and Image Processing; 2019;Shanghai, China.

Pike Msonda SAUSSK. Spatial Pyramid Pooling in Deep Convolutional Networks for Automatic Tuberculosis Diagnosis. Traitement du Signal, 2020; 37(6):1075-1084.

Xudong Liu HLSH. Tuberculosis Detection from Computed Tomography with Convolutional Neural Networks. Advances in Computed Tomography, 2019;(8)4: 47-56.

Gidwani UGADNBS, Tuberculosis Detection Using Convolutional Neural Network, SSRN, 2021.

Ho TKK, Gwak J, Prakash O, Song JI, Park CM. Utilizing pretrained deep learning models for automated pulmonary tuberculosis detection using chest radiography. 11th Asian Conference on Intelligent Information and Database Systems, ACIIDS; 2019;Yogyakarta, Indonesia.

Abbas A, Abdelsamea MM, Gaber MM. Detrac: Transfer learning of class decomposed medical images in convolutional neural networks. IEEE Access, 2020;8:74901-74913.

Rahman T, Khandakar A, Kadir MA, Islam KR, Islam KF, Mazhar R, Hamid T, et al. Chowdhury. Reliable tuberculosis detection using chest X-ray with deep learning, segmentation and visualization. IEEE Access, 2020;8:191586-191601.

Simonyan AZK. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.


Download data is not yet available.


How to Cite
Rabby, S.F., Hasan, A. , Soeb, M.J.A., Shirsho, G.P. and Talukdar, B. 2022. Performance Analysis of Different Convolutional Neural Network (CNN) Models with Optimizers in Detecting Tuberculosis (TB) from Various Chest X-ray Images. European Journal of Engineering and Technology Research. 7, 4 (Aug. 2022), 21–30. DOI: