Volume 14, Number 6

Advanced Hierarchical Imaging Techniques in TB Diagnosis: Leveraging Swin Transformer for Enhanced Lung Tuberculosis Detection

  Authors

Syed Amir Hamza and Alexander Jesser, Heilbronn University of Applied Sciences, Germany

  Abstract

Lung Tuberculosis (TB) remains a critical health issue globally. Accurately detecting TB from chest x-rays is vital for prompt diagnosis and treatment. Our study introduces an innovative approach using the swin transformer to assist healthcare professionals in making faster, more accurate diagnoses. This method also aims to lower diagnostic costs by streamlining the detection process. The swin transformer, a sophisticated vision transformer, leverages hierarchical feature representation and a shifted window mechanism for improved image Analysis. Our research utilizes the nihchest x-ray dataset, comprising 1,557 non-tb and 3,498tb images. We divided the dataset into training, validation, and testing sets in a 64%,16%, and 20% ratio, respectively. The images undergo preprocessing—random resized crop, horizontal flip, and Normalization—before being converted into tensors. We trained the swin transformer model over 50 epochs, with a batch size of 8, using the adam optimizer at a learning rate of 1e-5. We closely monitored the model's accuracy and loss, assessing its performance using metrics like the f1-score, precision, and recall. Our findings show the model achieving a peak accuracy of 0.88 in the 43rd epoch for the training set, and the same accuracy for the validation set after 20 epochs. During testing, we observed a precision of 0.7928 and 0.9008, recall of 0.7749 and 0.9099, and f1-scores of 0.7837 and 0.905 for the negative and positive classes, respectively. The swin transformer demonstrates promising results, suggesting its adaptability and potential in significantly enhancing diagnostic efficiency and accuracy in medical settings.

  Keywords

Lung tuberculosis, Medical diagnostics, Swin Transformer, Vision transformer, Hierarchical feature representation, Shifted window mechanism, Deep learning, Computer vision, Medical image analysis, NIH Chest X-ray dataset, Early diagnosis