Source-linked AI summary
Reliable Tuberculosis Detection using Chest X-ray with Deep Learning, Segmentation and Visualization
Tawsifur Rahman, Amith Khandakar, Muhammad Abdul Kadir, Khandaker R. Islam, Khandaker F. Islam, Rashid Mazhar, Tahir Hamid, Mohammad T. Islam, Zaid B. Mahbub, Mohamed Arselene Ayari, Muhammad E. H. Chowdhury
TL;DR
The paper addresses reliable and early TB detection from chest X-rays, where manual interpretation can be time-consuming and subjective. It combines preprocessing, augmentation, lung segmentation, transfer-learned CNN classification, and Score-CAM visualization. Segmented-lung classification outperformed whole-image classification, reaching 99.9% accuracy with DenseNet201.
Problem
Chest X-ray TB diagnosis can be time-consuming and subjective, motivating more reliable automated detection and evaluation of lung-focused classification.
Method
The study evaluates two U-Net segmentation models and nine pre-trained CNNs on original and segmented chest X-rays, using preprocessing, augmentation, and Score-CAM visualization.
Results
99.9% accuracy was achieved for segmented-lung classification versus 97.07% for non-segmented images, with DenseNet201 best on segmented lungs and ChexNet best without segmentation.
Takeaways & Limitations
The authors conclude that lung segmentation significantly improves TB classification accuracy and that Score-CAM supports decisions based on lung regions.
Abstract
from arXiv · showhide
Tuberculosis (TB) is a chronic lung disease that occurs due to bacterial infection and is one of the top 10 leading causes of death. Accurate and early detection of TB is very important, otherwise, it could be life-threatening. In this work, we have detected TB reliably from the chest X-ray images using image pre-processing, data augmentation, image segmentation, and deep-learning classification techniques. Several public databases were used to create a database of 700 TB infected and 3500 normal chest X-ray images for this study. Nine different deep CNNs (ResNet18, ResNet50, ResNet101, ChexNet, InceptionV3, Vgg19, DenseNet201, SqueezeNet, and MobileNet), which were used for transfer learning from their pre-trained initial weights and trained, validated and tested for classifying TB and non-TB normal cases. Three different experiments were carried out in this work: segmentation of X-ray images using two different U-net models, classification using X-ray images, and segmented lung images. The accuracy, precision, sensitivity, F1-score, specificity in the detection of tuberculosis using X-ray images were 97.07 %, 97.34 %, 97.07 %, 97.14 % and 97.36 % respectively. However, segmented lungs for the classification outperformed than whole X-ray image-based classification and accuracy, precision, sensitivity, F1-score, specificity were 99.9 %, 99.91 %, 99.9 %, 99.9 %, and 99.52 % respectively. The paper also used a visualization technique to confirm that CNN learns dominantly from the segmented lung regions results in higher detection accuracy. The proposed method with state-of-the-art performance can be useful in the computer-aided faster diagnosis of tuberculosis.
I. INTRODUCTION
The paper addresses limitations of manual and whole-image TB screening by combining transfer-learned CNNs, lung segmentation, and visualization for chest X-ray classification.
- Chest X-ray diagnosis is time-consuming and subjective, with radiographs sometimes misclassified because of similar disease patterns and limited radiologist availability.
- Prior TB studies used classical machine learning, deep CNNs, transfer learning, and ensembles, but reported varied classification performance.
- The study focuses on transfer-learning CNN classification using both original chest X-rays and segmented lung images.
- The proposed focus on lung regions is intended to assess whether segmentation reduces learning from irrelevant thoracic regions and improves TB detection reliability.
- The authors investigate two U-Net models, nine pre-trained CNNs, comparisons between whole and segmented images, and Score-CAM visualization.
II. BACKGROUND
The background describes transfer learning with several pre-trained CNN architectures, including networks designed for efficiency, depth, feature reuse, or chest X-ray analysis.
- A. DEEP CONVOLUTIONAL NEURAL NETWORKS (CNNS) BASED TRANSFER LEARNING: Transfer learning is presented as useful for CNN applications when the available dataset is not large.
- A. DEEP CONVOLUTIONAL NEURAL NETWORKS (CNNS) BASED TRANSFER LEARNING: Nine pre-trained CNNs were used, spanning ResNet, DenseNet, ChexNet, SqueezeNet, InceptionV3, VGG19, and MobileNetV2 architectures.
- A. DEEP CONVOLUTIONAL NEURAL NETWORKS (CNNS) BASED TRANSFER LEARNING: DenseNet reduces redundant feature learning through direct access to the original input and loss gradients across layers.
- A. DEEP CONVOLUTIONAL NEURAL NETWORKS (CNNS) BASED TRANSFER LEARNING: ChexNet is a modified DenseNet121 model specially trained on a large number of chest X-ray images.
- A. DEEP CONVOLUTIONAL NEURAL NETWORKS (CNNS) BASED TRANSFER LEARNING: SqueezeNet and MobileNetV2 are comparatively compact, while VGG emphasizes network depth and uses small receptive fields.
B. SEGMENTATION
The segmentation section compares original and modified U-Net architectures for isolating lungs and uses visualization to examine which X-ray regions influence CNN decisions.
- B. SEGMENTATION: Two U-Net variants, original U-Net and Modified U-Net, were investigated for chest X-ray segmentation.
- B. SEGMENTATION: Original U-Net uses contracting and expanding paths with repeated convolutions, ReLU activations, and max pooling for downsampling.
- B. SEGMENTATION: Modified U-Net replaces simple skip-connection concatenation with bidirectional ConvLSTM to combine corresponding contracting and expanding feature maps nonlinearly.
- C. VISUALIZATION TECHNIQUES: Score-CAM heat maps show which different X-ray regions CNNs use during decision making.
- B. SEGMENTATION: The complete methodology includes separate segmentation and classification databases and three experiments covering U-Net selection, classification, and visualization.
III. METHODOLOGY
The methodology builds separate datasets for lung segmentation and TB classification, using Kaggle radiographs with masks and multiple public CXR databases. Two U-Net models are investigated for segmentation before classifying TB and normal cases.
- Two databases were created: one for lung segmentation and another for TB classification.
- 704 Kaggle X-ray images have corresponding expert-radiologist lung masks, including 360 normal and 344 abnormal images.
- TB classification uses NLM, Belarus, and RSNA chest X-ray databases.
- Figure 5 presents representative CXR images from the CHN, MC, Belarus, and RSNA datasets.
- The classification database contains 700 TB-infected and 3,500 normal chest X-ray images.
B. PREPROCESSING AND DATA AUGMENTATION
Preprocessing resizes and normalizes images for network-specific inputs, while augmentation expands the smaller TB class through rotations and translations. The supplied tables identify training, validation, and test sets for segmentation and classification.
- Preprocessing: Segmentation images are resized to 256×256 pixels, while classification inputs use 227×227 pixels for InceptionV3 and 224×224 pixels for other CNNs.
- Preprocessing: Z-score normalization is applied during image preprocessing.
- Data augmentation: The 3,500 normal images outnumber the 700 TB-infected images fivefold, so TB images are augmented four times to balance the database.
- Data augmentation: Figure 6 illustrates the original image, ±10-degree rotations, and 10% translation.
- Data augmentation: Augmentation uses clockwise and counter-clockwise rotations and horizontal or vertical translations.
C. EXPERIMENTS
The experiments evaluate U-Net variants for lung segmentation and nine pretrained CNNs for TB classification using both whole and segmented X-ray images. Five-fold cross-validation supports the classification evaluation.
- Lung Segmentation: Original U-Net and Modified U-Net are compared for lung segmentation using 80% training and 20% testing images.
- TB Classification: Nine CNNs classify TB and non-TB cases separately from non-segmented and segmented X-ray images.
- TB Classification: The evaluated models include three comparatively shallow networks and six deep networks.
- TB Classification: ResNet variants compare depth effects, while CheXNet provides comparison with a model pretrained on chest X-ray images.
- TB Classification: Five-fold cross-validation results are averaged to produce ROC curves, confusion matrices, and evaluation matrices.
D. PERFORMANCE MATRIX
Segmentation is evaluated with loss, accuracy, IoU, and Dice, whereas TB classification uses accuracy, sensitivity, specificity, precision, AUC, and F1 score. Confusion-matrix terms define the underlying positive and negative decisions.
- Lung Segmentation: Lung segmentation performance is compared using loss, accuracy, IoU, and Dice metrics.
- TB Classification: TB classification performance is compared using accuracy, sensitivity, specificity, precision, AUC, and F1 score.
- Confusion-matrix terms: True positives and true negatives count correctly identified TB and normal images, respectively.
- Confusion-matrix terms: False positives count normal images incorrectly identified as TB, while false negatives count TB images incorrectly identified as normal.
IV. RESULTS AND DISCUSSIONS
The study evaluated U-Net lung segmentation and compared TB classification using original versus segmented chest X-rays. The better-performing segmentation model was applied to the classification database, with qualitative validation because ground-truth masks were unavailable there.
- A. LUNG SEGMENTATION: Original U-Net outperformed modified U-Net in segmenting lung regions on chest X-rays.The comparison used test images, ground-truth masks, and segmented outputs.
- A. LUNG SEGMENTATION: The original U-Net was used to segment 3,500 normal and 700 TB images for the classification experiments.The classification database was an unseen image set for the trained segmentation model.
- A. LUNG SEGMENTATION: Quantitative evaluation on the classification database was unavailable because it lacked ground-truth lung masks.Segmentation quality was therefore assessed qualitatively by checking whether images were segmented correctly.
- B. TB CLASSIFICATION: The study compared nine CNN classifiers using both non-segmented and segmented chest X-ray images.The comparison is summarized in Table 4 and ROC curves are shown for both input types.
B. TB CLASSIFICATION
TB classification was evaluated with nine CNNs on original and lung-segmented X-rays. Segmentation improved performance across the tested networks, with DenseNet201 achieving the strongest segmented-image results and substantially fewer confusion-matrix errors.
- B. TB CLASSIFICATION: ResNet18, ResNet50, and ResNet101 showed increasingly better performance as depth increased for non-segmented images.The authors caution that this depth-related pattern did not generalize to VGG19 and InceptionV3.
- B. TB CLASSIFICATION: SqueezeNet and MobileNetv2 performed comparably to most deeper networks.For non-segmented images, CheXNet and ResNet101 had overlapping ROC curves, while the remaining networks were comparable.
- B. TB CLASSIFICATION: Lung-segmented chest X-rays provided a clear performance boost for all tested CNNs.The authors attribute the high reliability to classifying images containing only lung regions.
- B. TB CLASSIFICATION: CheXNet and DenseNet201 achieved the highest accuracies of 97.07% without segmentation and 99.9% with segmentation, respectively.CheXNet was strongest for non-segmented images, whereas DenseNet201 was strongest for segmented lungs.
- B. TB CLASSIFICATION: With non-segmented images, ChexNet misclassified 18 of 700 TB images as normal and 105 of 3,500 normal images as TB.With segmented lungs, DenseNet201 misclassified 4 of 700 TB images as normal and no normal images as TB.
C. VISUALIZATION USING SCORE-CAM
Score-CAM was used to examine which image regions supported CNN decisions. Heat maps indicated that segmented-lung inputs focused decision-making within the lungs, while misclassified cases often relied on limited lower-lung regions.
- C. VISUALIZATION USING SCORE-CAM: Score-CAM heat maps showed that segmented-lung inputs concentrated the CNN’s dominant decision-making regions within the lungs.The authors connect this focus with learning differences between normal and TB-infected lung images.
- C. VISUALIZATION USING SCORE-CAM: The authors link lung-focused learning to higher classification accuracies because TB changes lung opacities on chest X-rays.This provides the paper’s stated interpretation of why segmentation improves classification.
- C. VISUALIZATION USING SCORE-CAM: All four misclassified images drew CNN decisions from the lower lung edge and a small lung area.That selected portion was normal in each image.
- C. VISUALIZATION USING SCORE-CAM: One misclassified TB image resembled a normal image and may have represented an early TB stage, while three others involved mild-to-moderate TB.The authors suggest further dividing segmented lungs into patches as future work.
- C. VISUALIZATION USING SCORE-CAM: The study compared its reported performance with recent TB detection studies, including studies reporting 99.8% accuracy on smaller databases.The authors state that their study used larger datasets and found consistent results.
V. CONCLUSION
The paper presents transfer learning with deep CNNs for automatic TB detection from chest radiographs and evaluates nine models. ChexNet performed best without segmentation, DenseNet201 performed best with segmented lungs, and Score-CAM indicated lung-focused decisions after segmentation.
- V. CONCLUSION: The study evaluated nine deep CNN models for classifying TB and normal chest X-ray images.The approach used transfer learning for automatic detection from chest radiographs.
- V. CONCLUSION: ChexNet achieved 97.07% accuracy without segmentation, while DenseNet201 achieved 99.9% accuracy with segmented lungs.The corresponding precision and recall values were 97.34% and 97.07% without segmentation, and 99.91% and 99.9% with segmentation.
- V. CONCLUSION: Score-CAM indicated that segmentation shifted CNN decisions toward lung regions rather than features outside the lungs.The conclusion identifies lung segmentation as crucial for computer-aided diagnosis using radiographs.