Discover Analytics
Leakage aware tuberculosis detection from chest X-ray images using TBFuseFormer with Swin Transformer V2 and pretrained DINOv2 feature fusion
By Abdur Rahim, Md Sazzad Hossain Shehan, Mazharul Islam and 6 others.
Abstract
Reliable tuberculosis detection from chest X-ray images requires both discriminative representation learning and evaluation protocols that minimize data leakage and source-related bias. This study proposes TBFuseFormer, a dual-branch framework that integrates hierarchical local features from Swin Transformer V2 with global semantic representations from a pretrained DINOv2 encoder. The two feature streams are combined through feature concatenation and channel attention-guided fusion for binary classification of normal and TB-positive chest radiographs. Experiments were conducted on a curated multi-source dataset containing 7698 images, comprising 4220 normal and 3478 TB-positive cases. Duplicate and near-duplicate images were removed before partitioning, and the final dataset was divided into training, validation, and held-out test sets of 5389, 1155, and 1154 images, respectively. To ensure fair comparison, all nine evaluated architectures underwent independent model-specific hyperparameter optimization. TBFuseFormer achieved a five-fold cross-validation accuracy of 99.51 ± 0.12% after optimization and a held-out test accuracy of 99.39%, outperforming tuned Swin Transformer V2 Base, ConvNeXt V2 Base, and standalone DINOv2 ViT-B/14. Leave-one-source-out evaluation further demonstrated strong unseen-source generalization, with a mean accuracy of 95.23%, balanced accuracy of 94.36%, F1-score of 93.39%, Matthews correlation coefficient of 0.864, and AUROC of 0.9836. These findings indicate that TBFuseFormer provides strong leakage-aware classification performance, robust cross-source discrimination, quantitatively supported localization faithfulness, and practical deployment options, although independent multicenter and prospective validation remains necessary.







