Explainable Pediatric Pneumonia Detection from Chest X-Ray Images: Assessing Model Attention with Lung-Region Masking
Keywords:
Pediatric Pneumonia, Chest Radiograph, Lung Segmentation, Explainable AI, GradCAM, Shortcut Learning, deep learningAbstract
Deep learning models reach very high scores on the public pediatric chest radiograph dataset for pneumonia. It is not clear which part of the image these models use. This study tests the role of the lung fields with controlled input tests. A UNet trained on public adult lung masks is applied to 5,824 pediatric images that remain after 32 duplicates are removed. The automatic mask check excluded 409 images (7.0 percent), so 5,415 images are used. The split is grouped by patients. All final evaluations are done on 826 test images (232 normal and 594 pneumonia). Three versions of every image are built. These are the original image, the lung only image and the background only image with the lung fields removed. ResNet50, DenseNet121, EfficientNetB0 and MobileNetV3 Large are trained on each version with three seeds and tested on all versions. When training and test inputs matched, the test AUC is 0.997 to 0.998 for original images, 0.988 to 0.997 for lung only images and 0.990 to 0.995 for background only images. Models trained on original images kept an AUC of 0.964 to 0.975 on background only images but fell to 0.585 to 0.888 on lung only images. All 24 McNemar tests are significant after Holm adjustment. Control tests gave an AUC of 0.982 to 0.986 from an outer frame only and 0.989 to 0.993 with lung margins of 11, 31 and 51 pixels. Five image numbers alone, with no lung information, gave an AUC of 0.934. GradCAM placed 31.5 percent of attention inside the lung masks, which cover 21.0 percent of the image. High scores can therefore be reached without the segmented lung fields, and the classes differ in how the images are acquired. High accuracy on this dataset should not be read as proof that a model reads the lungs.
References
D. S. Kermany et al., “Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning,” Cell, vol. 172, no. 5, pp. 1122-1131.e9, Feb. 2018, doi: 10.1016/J.CELL.2018.02.010.
S. Rajaraman, S. Candemir, I. Kim, G. Thoma, and S. Antani, “Visualization and Interpretation of Convolutional Neural Network Predictions in Detecting Pneumonia in Pediatric Chest Radiographs,” Appl. Sci. 2018, Vol. 8, Page 1715, vol. 8, no. 10, p. 1715, Sep. 2018, doi: 10.3390/APP8101715.
J. R. Zech, M. A. Badgeley, M. Liu, A. B. Costa, J. J. Titano, and E. K. Oermann, “Variable generalization performance of a deep learning model to detect pneumonia in chest radiographs: A cross-sectional study,” PLoS Med., vol. 15, no. 11, Nov. 2018, doi: 10.1371/JOURNAL.PMED.1002683.
R. Geirhos et al., “Shortcut Learning in Deep Neural Networks,” Nat. Mach. Intell., vol. 2, no. 11, pp. 665–673, Nov. 2023, doi: 10.1038/s42256-020-00257-z.
A. J. DeGrave, J. D. Janizek, and S. I. Lee, “AI for radiographic COVID-19 detection selects shortcuts over signal,” Nat. Mach. Intell. 2021 37, vol. 3, no. 7, pp. 610–619, May 2021, doi: 10.1038/s42256-021-00338-7.
G. Maguolo and L. Nanni, “A critic evaluation of methods for COVID-19 automatic detection from X-ray images,” Inf. Fusion, vol. 76, pp. 1–7, Dec. 2021, doi: 10.1016/j.inffus.2021.04.008.
R. R. Selvaraju, M. Cogswell, A. Das, R. Vedantam, D. Parikh, and D. Batra, “Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization,” Proc. IEEE Int. Conf. Comput. Vis., vol. 2017-October, pp. 618–626, Dec. 2017, doi: 10.1109/ICCV.2017.74.
A. Saporta et al., “Benchmarking saliency methods for chest X-ray interpretation,” Nat. Mach. Intell. 2022 410, vol. 4, no. 10, pp. 867–878, Oct. 2022, doi: 10.1038/s42256-022-00536-x.
N. Arun et al., “Assessing the Trustworthiness of Saliency Maps for Localizing Abnormalities in Medical Imaging,” Radiol. Artif. Intell., vol. 3, no. 6, p. e200267, Nov. 2021, doi: 10.1148/RYAI.2021200267.
K. Shahi and A. Bagale, “Weakly Supervised Pneumonia Localization from Chest X-Rays Using Deep Neural Network and Grad-CAM Explanations,” Dec. 2025, doi: 10.54364/JAIAI.2024.1126.
R. Ridwan, “XAI-Guided Analysis of Residual Networks for Interpretable Pneumonia Detection in Paediatric Chest X-rays,” Jul. 2025, Accessed: Oct. 20, 2026. [Online]. Available: https://arxiv.org/pdf/2507.18647v1
A. Saber, A. Fateh, P. Parhami, A. Siahkarzadeh, M. Fateh, and S. Ferdowsi, “Efficient and Accurate Pneumonia Detection Using a Novel Multi-Scale Transformer Approach,” Oct. 2025, Accessed: Oct. 20, 2026. [Online]. Available: https://arxiv.org/pdf/2408.04290v1
A. Brown, N. Tomasev, J. Freyberg, Y. Liu, A. Karthikesalingam, and J. Schrouff, “Detecting shortcut learning for fair medical AI using shortcut testing,” Nat. Commun. 2023 141, vol. 14, no. 1, pp. 4314-, Jul. 2023, doi: 10.1038/s41467-023-39902-7.
I. Banerjee et al., “‘Shortcuts’ Causing Bias in Radiology Artificial Intelligence: Causes, Evaluation, and Mitigation,” J. Am. Coll. Radiol., vol. 20, no. 9, pp. 842–851, Sep. 2023, doi: 10.1016/j.jacr.2023.06.025.
B. G. Hill, F. L. Koback, and P. L. Schilling, “The risk of shortcutting in deep learning algorithms for medical imaging research,” Sci. Reports 2024 141, vol. 14, no. 1, pp. 29224-, Nov. 2024, doi: 10.1038/s41598-024-79838-6.
C. Vásquez-Venegas et al., “Detecting and Mitigating the Clever Hans Effect in Medical Imaging: A Scoping Review,” J. imaging informatics Med., vol. 38, no. 4, pp. 2563–2579, Aug. 2025, doi: 10.1007/S10278-024-01335-Z.
D. Juodelyte, Y. Lu, A. Jiménez-Sánchez, S. Bottazzi, E. Ferrante, and V. Cheplygina, “Source Matters: Source Dataset Impact on Model Robustness in Medical Imaging,” Lect. Notes Comput. Sci. (including Subser. Lect. Notes Artif. Intell. Lect. Notes Bioinformatics) , vol. 15384 LNCS, pp. 105–115, 2025, doi: 10.1007/978-3-031-82007-6_11/SAVE-RESEARCH.
A. Jiménez-Sánchez, D. Juodelyte, B. Chamberlain and V. Cheplygina., “Detecting Shortcuts in Medical Images - A Case Study in Chest X-Rays,” IEEE 20th Int. Symp. Biomed. Imaging, doi: doi: 10.1109/ISBI53787.2023.10230572.
S. Aslani et al., “Optimising Chest X-Rays for Image Analysis by Identifying and Removing Confounding Factors,” Lect. Notes Electr. Eng., vol. 810 LNEE, pp. 245–254, 2023, doi: 10.1007/978-981-16-6775-6_20/SAVE-RESEARCH.
L. O. Teixeira et al., “Impact of Lung Segmentation on the Diagnosis and Explanation of COVID-19 in Chest X-ray Images,” Sensors 2021, Vol. 21, Page 7116, vol. 21, no. 21, p. 7116, Oct. 2021, doi: 10.3390/S21217116.
S. C. Haynes, P. Johnston, and E. Elyan, “Generalisation challenges in deep learning models for medical imagery: insights from external validation of COVID-19 classifiers,” Multimed. Tools Appl. 2024 8331, vol. 83, no. 31, pp. 76753–76772, Feb. 2024, doi: 10.1007/S11042-024-18543-Y.
T. Sourget, M. Hestbek-Møller, A. Jiménez-Sánchez, J. Junchi Xu, and V. Cheplygina, “Mask of Truth: Model Sensitivity to Unexpected Regions of Medical Images,” J. Imaging Informatics Med. 2025 391, vol. 39, no. 1, pp. 767–784, May 2025, doi: 10.1007/S10278-025-01531-5.
O. Ronneberger, P. Fischer, and T. Brox, “U-net: Convolutional networks for biomedical image segmentation,” Lect. Notes Comput. Sci., vol. 9351, pp. 234–241, 2015, doi: 10.1007/978-3-319-24574-4_28/SAVE-RESEARCH.
S. Jaeger, S. Candemir, S. Antani, Y.-X. J. Wáng, P.-X. Lu, and G. Thoma, “Two public chest X-ray datasets for computer-aided screening of pulmonary diseases,” Quant. Imaging Med. Surg., vol. 4, no. 6, p. 475, Dec. 2014, doi: 10.3978/J.ISSN.2223-4292.2014.11.20.
S. Candemir et al., “Lung segmentation in chest radiographs using anatomical atlases with nonrigid registration,” IEEE Trans. Med. Imaging, vol. 33, no. 2, pp. 577–590, Feb. 2014, doi: 10.1109/TMI.2013.2290491.
N. Gaggion et al., “CheXmask: a large-scale dataset of anatomical segmentation masks for multi-center chest x-ray images,” Sci. Data 2024 111, vol. 11, no. 1, pp. 511-, May 2024, doi: 10.1038/s41597-024-03358-1.
A. Paszke et al., “PyTorch: An Imperative Style, High-Performance Deep Learning Library,” Adv. Neural Inf. Process. Syst., vol. 32, Dec. 2019, Accessed: May 25, 2024. [Online]. Available: https://arxiv.org/abs/1912.01703v1
P. Mooney., “Chest X Ray Images (Pneumonia),” Kaggle,, [Online]. Available: https://www.kaggle.com/datasets/paultimothymooney/chest-xray-pneumonia.
K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” Proc. IEEE Comput. Soc. Conf. Comput. Vis. Pattern Recognit., vol. 2016-December, pp. 770–778, Dec. 2016, doi: 10.1109/CVPR.2016.90.
G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger, “Densely Connected Convolutional Networks,” Proc. - 30th IEEE Conf. Comput. Vis. Pattern Recognition, CVPR 2017, vol. 2017-January, pp. 2261–2269, Aug. 2016, doi: 10.1109/CVPR.2017.243.
Mingxing Tan, Quoc V. Le, “EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks,” arXiv:1905.11946, 2020, [Online]. Available: https://arxiv.org/abs/1905.11946
A. Howard et al., “Searching for MobileNetV3,” Proc. IEEE Int. Conf. Comput. Vis., vol. 2019-October, pp. 1314–1324, May 2019, doi: 10.1109/ICCV.2019.00140.
I. Loshchilov and F. Hutter, “Decoupled Weight Decay Regularization,” 7th Int. Conf. Learn. Represent. ICLR 2019, Nov. 2017, Accessed: Oct. 06, 2026. [Online]. Available: https://arxiv.org/pdf/1711.05101
M. A. Abid., “Pneumonia detection from chest X ray,” Kaggle.
M. A. Abid., “Chest X ray updation 1,” Kaggle, [Online]. Available: https://www.kaggle.com/code/muhammadadeelabid/chest-x-ray-updation-1.
M. A. Abid., “Chest X ray updation 2,” Kaggle, [Online]. Available: https://www.kaggle.com/code/muhammadadeelabid/chest-x-ray-updation-2.
L. Maier-Hein et al., “Metrics reloaded: recommendations for image analysis validation,” Nat. Methods 2024 212, vol. 21, no. 2, pp. 195–212, Feb. 2024, doi: 10.1038/s41592-023-02151-z.
B. Efron and R. J. Tibshirani, “An Introduction to the Bootstrap,” An Introd. to Bootstrap, May 1994, doi: 10.1201/9780429246593.
Q. McNemar, “Note on the sampling error of the difference between correlated proportions or percentages,” Psychometrika, vol. 12, no. 2, pp. 153–157, Jun. 1947, doi: 10.1007/BF02295996.
“Holm, S. (1979) A Simple Sequentially Rejective Multiple Test Procedure. Scandinavian Journal of Statistics, 6, 65-70. - References - Scientific Research Publishing.” Accessed: Oct. 20, 2026. [Online]. Available: https://www.scirp.org/reference/referencespapers?referenceid=1798304
J. Hofmanninger, F. Prayer, J. Pan, S. Röhrich, H. Prosch, and G. Langs, “Automatic lung segmentation in routine imaging is primarily a data diversity problem, not a methodology problem,” Eur. Radiol. Exp., vol. 4, no. 1, p. 50, Dec. 2020, doi: 10.1186/S41747-020-00173-2.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 50sea

This work is licensed under a Creative Commons Attribution 4.0 International License.


















