A Leakage-Aware Deep Learning Framework for Reliable Chest X-ray Classification with Anatomically Constrained Explanations
Abstract
While Chest X-ray (CXR) classification effectively aids respiratory disease assessment, existing models often suffer from data leakage—the presence of duplicate or near-duplicate images across training, validation, and test sets that can artificially inflate performance metrics—and poor interpretability by highlighting non-pulmonary regions. We propose a leakage-aware framework integrating anatomically constrained explainability for reliable multi-class CXR classification. To prevent overly optimistic evaluation, MD5 and perceptual hashing were applied to eliminate duplicate/near-duplicate images prior to dataset splitting. Our pipeline employs an EfficientNet-B0 backbone to classify four categories (COVID-19, Lung Opacity, Viral Pneumonia, Normal) and a parallel U-Net model to extract lung masks. These masks constrain a Grad-CAM++ module, restricting activation maps exclusively to pulmonary regions and reducing spurious background attention. Results demonstrate a 95.57% classification accuracy, a 96.74% macro-F1 score, and a 0.9861 segmentation Dice coefficient. Ablation studies confirm that combining leakage control with ROI masking promotes reliable evaluation and effectively improves clinical interpretability, fostering more reliable clinical AI support tools.