Filename-grouped evaluation of deep learning AI models for pediatric pneumonia classification in chest radiographs
Figures
Abstract
Retrospective chest-radiograph classification requires explicit reporting of dataset labels and grouping assumptions. We evaluated 5,856 public pediatric chest radiographs in two tasks: NORMAL versus PNEUMONIA and BACTERIAL versus VIRAL dataset-label classification. Subtype labels were derived from filenames and lacked a uniform microbiological reference standard. Filename-grouped evaluation used subtype-qualified keys linked by exact decoded-image duplicates; patient identities were not independently verified. We completed 16 models: five grouped InceptionV3 runs for Task 1, five matched pairs of grouped and image-level DenseNet121 runs for Task 2, and one original-folder Task 2 comparator. Five repeated holdouts used seeds 17, 29, 42, 71 and 101; grouped seed-42 models supplied the primary estimates. Thresholds were selected using tuning balanced accuracy, with threshold sensitivity and filename-group bootstrap intervals. Primary accuracy was 94.90% (95% CI 93.23–96.40) for Task 1 and 77.03% (71.89–81.81) for Task 2; AUROC was 0.9846 and 0.8319, respectively. Across five Task 2 runs, mean accuracy was 77.42% for grouped and 77.88% for image-level partitions, a grouped-minus-image difference of −0.46 percentage points. The separate original-folder comparator achieved 92.82% accuracy and AUROC 0.9583. The controlled results show similar mean performance under the two specified partition rules. The larger original-folder difference cannot be attributed specifically to patient leakage. This dataset audit and evaluation-design replication supports transparent reporting of grouping uncertainty; it establishes neither verified patient independence nor clinical etiologic diagnosis.
Citation: Sigdel S, Nepal S, Nepal S (2026) Filename-grouped evaluation of deep learning AI models for pediatric pneumonia classification in chest radiographs. PLoS One 21(12): e0364142. https://doi.org/10.1371/journal.pone.0364142
Editor: Lorenzo Faggioni, University of Pisa, ITALY
Received: July 2, 2026; Accepted: November 19, 2026; Published: December 4, 2026
Copyright: © 2026 Sigdel et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Data Availability: No new clinical data were generated in this study. The chest radiograph dataset is publicly available through Mendeley Data (https://doi.org/10.17632/rscbjbr9sj.2). All derived data, statistical analyses, training histories, analysis code, and reproducibility instructions are publicly available on GitHub (https://github.com/saksham22244/BigData).
Funding: The author(s) received no specific funding for this work.
Competing interests: The authors have declared that no competing interests exist.
Introduction
Pneumonia is an acute respiratory infection of the lung parenchyma in which alveoli may become filled with fluid, inflammatory cells, or pus. It remains a leading cause of childhood morbidity and mortality, especially among young children and in settings where timely diagnosis, oxygen therapy, antimicrobial treatment, and radiology expertise are limited. Clinical presentation and prognosis vary by age, immune status, nutritional background, comorbidity, pathogen burden, vaccination history, and access to care [1–6]. Since clinical management depends on recognizing disease severity and, when possible, likely etiology, improving the reliability and transparency of pediatric pneumonia assessment remains an important clinical and computational problem.
Chest radiography is commonly used when pediatric pneumonia is suspected because it is accessible and rapid [6,7]. Radiographic findings may support clinical assessment, but image interpretation varies with acquisition quality, positioning, disease stage, and reader expertise. Radiographs alone also have limited ability to distinguish bacterial from viral pneumonia [7–9]. NORMAL versus PNEUMONIA classification and BACTERIAL versus VIRAL dataset-label classification are therefore separate computational tasks with different clinical interpretations.
Deep learning has created new opportunities for automated medical image analysis by allowing convolutional neural networks to learn hierarchical image representations directly from pixels [10–12]. Transfer learning is especially useful in medical imaging because biomedical datasets are often smaller than natural-image datasets used to train modern networks from random initialization [12,13]. ImageNet-pretrained models have been successfully adapted to several medical imaging tasks, including retinal disease, dermatology, and chest radiography [13–17]. Public chest radiograph datasets have accelerated method development and benchmarking, including datasets for pneumonia and multi-label thoracic abnormality classification [15–22]. These resources are valuable, but they can contain hidden structure that affects model evaluation.
The reliability of medical-imaging artificial intelligence depends on dataset composition, partitioning strategies, and the ability of models to generalize beyond their training data [23–25]. Dependence between images from the same individual and the presence of dataset-specific shortcuts can affect performance estimates [26–29]. Hidden stratification may further obscure important differences in model performance across patient or image subgroups [30]. Because filename-derived identifiers do not necessarily correspond to verified clinical identities, the present study distinguishes observable filename-group separation from unverified patient-level independence.
Reporting frameworks increasingly emphasize reproducible data handling, clear separation of development and testing, explicit reporting of data partitions, uncertainty estimation, and careful description of reference standards [31–36]. The 2024 Checklist for Artificial Intelligence in Medical Imaging (CLAIM) specifically asks authors to report data sources, preprocessing, partitioning, training procedures, performance metrics, uncertainty, and limitations [32]. STARD-AI extends diagnostic accuracy reporting for studies that use artificial intelligence and highlights dataset practices, index-test description, bias, fairness, and generalizability [33–35]. The present study was written in alignment with these principles while remaining explicit that it is an internal, retrospective, public-dataset analysis rather than a clinically deployable diagnostic device.
This study evaluates NORMAL versus PNEUMONIA and BACTERIAL versus VIRAL dataset-label classification under explicitly documented evaluation designs. It does not introduce a new architecture or claim that grouped partitioning is novel. Its contribution is a dataset audit and evaluation-design replication, including a five-seed controlled comparison of image-level and filename-grouped Task 2 partitions and transparent uncertainty about reconstructed identifiers. Previous work on this dataset has also reported overlap and repartitioning [37].
Materials and methods
Ethics statement
This retrospective methodological study used a publicly available, de-identified pediatric chest X-ray dataset and did not involve recruitment, intervention, direct contact with human participants, or collection of new clinical data. Because the analysis was limited to publicly available de-identified image files and filename-derived labels, institutional review board approval was not required. The authors did not have access to information that could identify individual participants during or after data collection.
Dataset and study design
The study used the public pediatric chest-radiograph dataset described by Kermany et al. [15]. The saved manifest contained 5,856 images: 1,583 NORMAL and 4,273 PNEUMONIA, including 2,780 BACTERIAL and 1,493 VIRAL filename labels. The original source folders contained 5,232 TRAIN, 624 TEST, and 0 VAL images. The manifest contained 4,097 qualified filename keys and 4,096 final split groups after exact-duplicate linkage. These are analysis units, not counts of independently verified patients. Fig 1 illustrates the three supplied label categories. The historical upstream archive version and archive checksum were not retained in the saved computational records. The image-level manifest and dataset content fingerprint define the analyzed snapshot; the acquisition reference does not establish the version of the historical download.
Panels show NORMAL, BACTERIAL PNEUMONIA and VIRAL PNEUMONIA. Images are the first lexicographic image identifier within each category and are illustrative, not selected for model confidence or diagnostic typicality. The labels do not establish microbiologically confirmed etiology.
Task 1 distinguished NORMAL from PNEUMONIA, with PNEUMONIA designated as the positive class. Task 2 included pneumonia images and classified the dataset-provided labels BACTERIAL and VIRAL, with VIRAL designated as the positive class. The subtype labels were extracted from filenames and were not supported by a uniform microbiological reference standard. Task 2 therefore measures discrimination against the supplied labels; it does not determine true pneumonia etiology or support treatment decisions.
Manifest construction and label engineering
The manifest recorded image identifiers, source folders, labels, parsing rules, file SHA-256 hashes, and hashes of decoded RGB pixels, along with image dimensions. For pneumonia filenames, the anchored pattern ^(person\d+)_(bacteria|virus)_ returned the person-number token plus subtype. Thus, person123_bacteria_1.jpeg mapped to person123_bacteria, while person123_virus_2.jpeg mapped to person123_virus; both had raw key person123. For NORMAL images the anchored patterns were ^(normal\d+-im-\d+), ^(normal\d+-\d+) and ^(im-\d+-\d+) after lowercasing. An unmatched name would use its first underscore-delimited prefix and be flagged as an unverified fallback. This fallback does not silently switch a grouped experiment to image-level splitting. The implementation and per-image mappings are retained in the reproducibility evidence.
Both raw and qualified keys were audited. Adding subtype to the key partly imposes subtype purity by construction; zero mixed-subtype qualified groups are therefore not independent evidence that bacterial and viral files belong to different people. Conversely, matching raw person-number prefixes across subtypes does not prove a shared person. No authoritative image-to-patient linkage was available for independent verification. The reliability of filename-derived grouping was evaluated at two distinct levels: syntactic consistency and partition integrity. Syntactic consistency was assessed by applying predefined filename patterns and recording unmatched filenames or fallback assignments. Partition integrity was assessed through comparisons of filename-derived keys and exact decoded-image hashes across training, tuning, and test partitions. These checks establish whether the implemented grouping rules are reproducible and whether their separation constraints are satisfied. They do not independently establish that the derived keys correspond to unique clinical patients. Consequently, filename-grouped evaluation is used throughout this study as an operational description of the partitioning procedure rather than as a synonym for verified patient-level separation. Fig 2 presents the workflow and its identity limitation.
(A) Dataset construction, filename-key audits, and exact decoded-image duplicate linkage. (B) Sixteen models: five filename-grouped Task 1 models, five filename-grouped and five image-level Task 2 models paired by seed, and one separate original-folder Task 2 comparator. (C) Model fitting, tuning-based checkpoint and threshold selection, held-out evaluation, and evidence reporting. The primary figures and intervals reuse the grouped seed-42 models.
Task 1 labels came from the NORMAL and PNEUMONIA folder names. Task 2 retained pneumonia files containing an explicit bacteria or virus filename token. These filename-derived subtype labels were treated as dataset labels and not as microbiologically confirmed etiologies.
Sixteen distinct models were fitted. Task 1 used filename-grouped evaluation with seeds 17, 29, 42, 71 and 101. Task 2 used the same five seeds for both the filename-grouped and image-level evaluation, with identical modeling procedures between its controlled designs. A separate original-folder Task 2 comparator used seed 42. Grouped seed-42 models were reused for the primary figures and intervals. Generated grouped partitions assigned approximately 70%, 15%, and 15% of groups to training, tuning, and test sets with group-level stratification; image proportions could differ because groups contained different numbers of images. Image-level partitions used the same target proportions with image-label stratification. These are repeated holdouts, not five-fold cross-validation or independent cohorts. The individual seed-level results for both tasks and the matched Task 2 comparisons are provided in S1 Table (Tables A–D). The original-folder comparator retained source TEST images and split source TRAIN groups into 85% training and 15% tuning; VAL was excluded from this comparator and original TRAIN/TEST overlap denominators. Table 1 summarizes source-folder and primary partition counts.
Exact decoded-image copies with the same supplied labels were retained and linked into indivisible components for generated group partitions. The audit identified 62 images in 30 exact-copy sets (32 copies beyond one image per set), with no contradictory exact-image labels. Conflicting exact-image labels would stop analysis for source-data resolution. Image-level partitions imposed no grouping or duplicate-component constraint; their overlap was audited. Original folder assignments were preserved and audited separately. Exact hashing detects identical decoded content, not every near duplicate. Generated group partitions had zero overlap for qualified keys, linked split groups, and exact decoded images; this establishes separation under those definitions, not independently verified patient separation.
Image preprocessing, augmentation, and class balancing
Images were loaded from the pandas manifest using TensorFlow/Keras DataFrame-based image generators. For Task 1, images were resized to 299 x 299 x 3 pixels and processed with the InceptionV3 preprocessing function. For Task 2, images were resized to 320 x 320 x 3 pixels and processed with the DenseNet preprocessing function. No manual cropping, segmentation, or contrast enhancement was applied.
Training images were augmented to improve robustness and reduce overfitting [38]. For Task 1, augmentation included rotations up to 12 degrees, width and height shifts of 0.08, zoom up to 0.15, shear of 0.05, brightness variation from 0.85 to 1.15, horizontal flipping, and nearest-pixel filling. Task 2 used a distinct, more conservative augmentation scheme. Task 2 augmentation included rotations up to 8 degrees, width and height shifts of 0.05, zoom up to 0.10, brightness variation from 0.90 to 1.10, horizontal flipping, and nearest-pixel filling.
Training images were augmented as specified above. Row-replication oversampling was disabled in all revised runs. Class weights were computed from the unreplicated training partition as N/(2n_c), where n_c is the number of training images in class c. This avoids explicit minority-row replication but does not eliminate memorization, label ambiguity, or dataset shortcuts. Tuning generators used unaugmented images during checkpoint selection. Final Task 1 tuning and test predictions used the same three deterministic image-ID-specific augmentation transforms; Task 2 final inference used one unaugmented pass.
Classification outputs and optimization
Each model produced one sigmoid probability for the designated positive class and was optimized with binary cross-entropy. PNEUMONIA was positive for Task 1, and VIRAL was positive for Task 2. Standard definitions of the loss and classification metrics are omitted so that the Methods focus on the parser, partitions, threshold rule, and uncertainty analysis specific to this study.
Model training, fine-tuning, threshold selection, and test-time inference
InceptionV3 was used for Task 1 and DenseNet121 for Task 2 [39,40], initialized with ImageNet weights [41,42]. Task 1 froze the backbone and used global average pooling, dropout 0.5, and a sigmoid output, batch size 32, and Adam with an initial learning rate of 0.001 for at most 30 epochs. Its checkpoint minimized the tuning loss, with early-stopping patience 10, minimum improvement 0.0001, and learning-rate plateau patience 4. DenseNet121 used global average pooling, batch normalization, dropout 0.4, a 256-unit ReLU layer, batch normalization, dropout 0.3, and a sigmoid output. Batch size was 16. Its frozen-backbone stage used Adam at 0.001 for at most 12 epochs; fine-tuning used 0.000003 for at most 25 epochs. The last 100 backbone layer positions were considered for unfreezing while batch-normalization layers remained frozen, yielding 71 trainable backbone layers and 2,186,241 trainable parameters. Task 2 early-stopping patience was 7, and plateau patience was 3. Actual completed epochs are reported in the Results.
Task 2 checkpoints were selected by maximum tuning AUROC within the fine-tuning stage, following initialization from the selected head-stage weights. This is the explicit selection rule for the revised controlled comparison and replaces the earlier single-split selection procedure; it was identical for both controlled Task 2 designs and the original-folder comparator. Task 1 retained tuning-loss selection. Compatible completed runs were reused only after dataset, exact partition, configuration, software, and checkpoint checks. Epoch checkpoints retained model and optimizer state, completed epoch, selected weights, history, and callback counters; interrupted execution resumed without resetting completed epochs. This manuscript revision reused the completed experiment and performed no additional model fitting.
Decision thresholds were selected from tuning predictions by maximizing balanced accuracy over 0.10 to 0.90 in increments of 0.01. Ties were resolved first by higher tuning accuracy, then by the lower threshold. Test predictions were not used for threshold selection. The selected thresholds were 0.55 for primary Task 1, 0.65 for primary Task 2, and 0.56 for the original-folder comparator. The Results report sensitivity to a 0.50 threshold and selected-threshold perturbations of ±0.05. Duplicate thresholds were listed once. A better test score at another examined threshold was not used to replace the tuning-selected operating point.
Probabilities at or above the selected threshold were assigned to PNEUMONIA for Task 1 and VIRAL for Task 2. Task 1 used three fixed image-ID-specific transforms with a consistent physical prediction batch of 32; short batches were padded and padding outputs discarded. Evaluation displayed classifications and occluded variants used the same inference function. This avoided inconsistent correctness labels caused by different inference procedures. Task 2 used single-pass inference. Since architecture, image sizes, augmentation, training, and inference differed between tasks, their performance comparison is descriptive.
Evaluation and statistical analysis
Accuracy, sensitivity, specificity, precision, F1 score, and area under the receiver operating characteristic curve (AUROC) were computed on held-out test data. Sensitivity refers to PNEUMONIA in Task 1 and VIRAL in Task 2. Recall is not reported as a separate summary row because it is identical to sensitivity for the designated positive class.
AUROC was computed from continuous probability scores. Across repeated holdouts, we reported mean, sample standard deviation, and range for each task/design, plus paired seed-wise grouped-minus-image-level differences for Task 2. The full run-level results and paired differences are tabulated in S1 Table (Tables A–D), with split counts in Tables E and F. These summaries are descriptive: holdout sets overlap across repetitions and are not independent cohorts. The controlled Task 2 procedures had the same DenseNet121 specification, augmentation, class-weight formula, epoch limits, fine-tuning-stage checkpoint rule, threshold criterion, and target split proportions. The partitions necessarily differed in group membership and image counts; matching target proportions does not make the case mix identical.
For the two primary grouped seed-42 models and the original-folder comparator, 95% intervals were the 2.5th and 97.5th percentiles from 2,000 attempted bootstrap draws, with bootstrap seed 42. Each draw sampled final filename/duplicate-linked groups with replacement and retained every image in each sampled group, including repeated contributions when a group was drawn more than once. The saved primary and comparator interval tables recorded 2,000 effective draws for each reported metric. These intervals condition on the selected model, split and filename grouping; they do not capture all training variability or establish patient-level independence. They were not recomputed during manuscript revision.
Reproducibility and reporting
The notebook exports software and hardware metadata, parser rules, fallback and duplicate checks, group distributions, source-folder overlap, split assignments, per-image predictions, thresholds, threshold-sensitivity results, cluster-bootstrap intervals, training histories, and SHA-256 fingerprints for the manifest and configuration. Random seeds and Task 2 positive-class definition are stored with the outputs. Placeholder figures and missing repeated-split results fail the final artifact audit.
Reporting distinguishes filename-grouped evaluation, image-level evaluation, and the original-folder comparator. AUROC and chest radiograph terminology are used consistently, and abbreviations are defined at first use. The study is an internal retrospective dataset audit; it is not a clinical trial or population-screening evaluation. The study follows relevant reporting principles for medical-imaging AI and retrospective model evaluation, including transparent descriptions of data sources, partitioning, performance assessment, and limitations [32,33,36,43]. The CLAIM and STARD-AI reporting checklist are provided as S1 Checklist. S1 File contains the analysis code and reproducibility instructions, while S1 Dataset contains the derived data and saved experimental evidence. These supporting materials are separate from the analysis workflow presented in Fig 2.
Data and code availability
The source chest radiographs described by Kermany et al. [15] are available from Mendeley Data. Version 2 (https://doi.org/10.17632/rscbjbr9sj.2) is provided as an acquisition reference; the historical archive version used for these experiments is unverified. The analyzed snapshot is specified by the 5,856-image manifest and the dataset content fingerprint in the repository. The analysis notebook, matching Python source, parsing rules, derived manifest, all split assignments, tuning and test predictions, thresholds, per-run metrics, bootstrap intervals, training histories, software records, and checksums are publicly available at https://github.com/saksham22244/BigData. Derived identifiers are dataset filenames and analysis keys, not independently verified patient identifiers. The original radiographs and native model/optimizer checkpoints are not included in the repository. Saved-result verification on CPU requires neither the raw images nor the model checkpoints; new inference requires the corresponding images and weights, and retraining requires the dataset and recorded training procedure.
Qualitative occlusion-based error analysis
Occlusion used a 48 × 48-pixel block and stride 48, replacing each block with the image median. Within each primary seed-42 test set, images were sorted by image identifier, and one example was sampled with seed 42 in every available true-class × correct/incorrect stratum. Correctness was determined using the saved tuning-selected threshold and the task-specific inference procedure. The occlusion map represented the reduction in the probability of the predicted class, including the erroneous predicted class for a misclassification. The selection rule was fixed rather than manually chosen for visual appeal; these are qualitative examples, not validated disease localization [44,45].
Results
Dataset composition and split audit
All 5,856 filenames matched an explicit pattern (100%; denominator 5,856); no fallback was used. The patterns covered 666 IM-style NORMAL images, 917 NORMAL-number-IM images, and 4,273 person-number/subtype images. The 4,097 qualified keys included 726 multi-image keys, with a median of one and a maximum of 30 images per key. Exact-copy linkage produced 4,096 split groups, including 727 multi-image groups, with a median of one and a maximum of 30 images. The corresponding raw-key audit yielded 3,118 keys, including 979 mixed-subtype keys. These counts quantify parsing and grouping behavior, not the fraction of independently identified patients.
The overlap findings reflect two distinct identifier definitions rather than contradictory audit results. Raw-prefix matching identifies identical filename prefixes regardless of subtype, whereas subtype-qualified matching treats bacterial and viral filename categories separately. Consequently, a raw-prefix match across partitions does not necessarily represent the same patient, and the absence of qualified-key overlap does not establish patient independence. The observed raw-prefix overlaps quantify the extent to which the interpretation of partition separation depends on the selected identifier definition. These results provide a reproducible assessment of grouping uncertainty without assigning clinical identity to otherwise unverified filename tokens.
Across source TRAIN and TEST, 170 raw prefixes overlapped: 170/427 TEST raw keys (39.81%), affecting 457 TRAIN images and 320/624 TEST images (51.28%). VAL images were excluded. All such matches were cross-subtype: 107 TRAIN-BACTERIAL versus TEST-VIRAL keys and 63 TRAIN-VIRAL versus TEST-BACTERIAL keys. When the global cross-folder overlap set was applied to individual TEST categories, the affected counts were NORMAL: 0/225 TEST raw keys and 0/234 TEST images (0.00%); BACTERIAL: 63/77 TEST raw keys and 194/242 TEST images (80.17%); VIRAL: 107/126 TEST raw keys and 126/148 TEST images (85.14%). In contrast, comparisons restricted to the same subtype in both source folders found zero raw-prefix overlaps. Qualified keys, final split groups, and exact decoded-image hashes also showed zero original TRAIN/TEST overlap under their respective definitions. The differing results arise from the key definitions; neither interpretation verifies patient identity. Raw prefixes also crossed generated grouped partitions because subtype-qualified keys, not raw prefixes, defined the grouping constraint. For primary seed 42, training and test shared 211 raw keys in Task 1 and 212 in Task 2. These matches do not establish whether the files depict shared or different patients.
Task 1 NORMAL versus PNEUMONIA classification
Primary Task 1 used the grouped seed-42 InceptionV3 model and threshold 0.55. The test set contained 941 images. Accuracy was 94.90% (95% CI 93.23–96.40), sensitivity for PNEUMONIA 96.74%, specificity for NORMAL 89.41%, precision 96.46%, and F1 score 96.60%. AUROC was 0.9846 (95% CI 0.9774–0.9907; Table 2).
Across five Task 1 grouped holdouts, mean accuracy was 93.43% (sample SD 1.09 percentage points; range 92.37–94.90%) and mean AUROC was 0.9825 (SD 0.0055). The primary confusion matrix contained 211 correctly classified NORMAL images and 682 correctly classified PNEUMONIA images, with 25 false-positive and 23 false-negative classifications (Table 3 and Fig 3).
The confusion matrix uses the tuning-selected threshold 0.55; the ROC curve uses continuous probabilities. PNEUMONIA is the positive class. Results use the existing grouped seed-42 model.
These results describe internal discrimination of the supplied NORMAL and PNEUMONIA labels. They do not establish clinical effectiveness or performance in independently verified unseen patients. Comparisons with Task 2 remain descriptive because the pipelines differ.
Task 2 BACTERIAL versus VIRAL filename-grouped evaluation
Primary Task 2 used the grouped seed-42 DenseNet121 model and threshold 0.65. On 666 test images, accuracy was 77.03% (95% CI 71.89–81.81), sensitivity for VIRAL 67.80%, specificity for BACTERIAL 82.09%, precision 67.51%, and F1 score 67.65%. AUROC was 0.8319 (95% CI 0.7857–0.8788; Table 2).
The confusion matrix contained 353 correct BACTERIAL and 160 correct VIRAL predictions, with 77 BACTERIAL images classified as VIRAL and 76 VIRAL images classified as BACTERIAL (Table 3 and Fig 4). Across five grouped Task 2 holdouts, mean accuracy was 77.42% (SD 0.90 percentage points; range 76.22–78.66%) and mean AUROC was 0.8343 (SD 0.0073).
VIRAL is the positive class and BACTERIAL the negative class. The confusion matrix uses the tuning-selected threshold 0.65; the ROC curve uses continuous probabilities from the existing grouped seed-42 model. Labels represent the supplied dataset categories, not microbiologically confirmed etiology.
Task 2 evaluates discrimination of filename-derived dataset labels. Because radiographic appearances overlap and the dataset lacks a uniform microbiological reference standard, the analysis cannot establish determination of true bacterial or viral etiology [7–9].
Original folder and controlled Task 2 comparisons
The original-folder comparator evaluated 390 source TEST images, comprising 242 BACTERIAL and 148 VIRAL labels. At threshold 0.56, it achieved 92.82% accuracy (95% CI 89.08–96.12), sensitivity 85.14%, specificity 97.52%, precision 95.45%, F1 score 90.00% and AUROC 0.9583 (95% CI 0.9167–0.9887). There were 236 correct BACTERIAL and 126 correct VIRAL classifications, with 6 false-positive and 22 false-negative VIRAL classifications. This result is a separate descriptive comparator, not one member of the matched five-seed image-level design. Because the original-folder comparator was performed once, its difference from the grouped results was not assessed repeatedly across alternative original-folder partitions. Fig 5 presents the controlled five-seed comparison.
Panels show accuracy and AUROC for filename-grouped and image-level partitions at each matched seed. All ten runs used the same DenseNet121 modeling procedure and target partition proportions. Values are descriptive repeated-holdout results; connections between matched seeds do not imply identical test images or independent cohorts. Black diamonds indicate the mean performance across the five seeds for each partitioning design. The original-folder comparator is reported separately in Tables 2 and 3.
Mean image-level Task 2 accuracy was 77.88% (SD 0.86 percentage points), compared with 77.42% for filename-grouped evaluation. The mean paired grouped-minus-image-level difference was −0.46 percentage points. Mean AUROC was 0.8428 and 0.8343, respectively, a difference of −0.0084. The direction of the accuracy difference varied across seeds (Table 4 and Fig 5). The five matched accuracy differences (grouped minus image-level) were +0.01, + 0.74, −0.66, −1.79 and −0.59 percentage points for seeds 17, 29, 42, 71 and 101, respectively (S1 Table, Table A). The controlled comparison therefore showed similar average accuracy under these specified rules. The larger original-folder result involved different training and test composition and cannot be attributed specifically to patient leakage.
Qualitative occlusion-based error analysis
The eight examples cover each available true-class and correct/incorrect stratum in the two primary test sets. Selection used seed 42, the same selected model, inference procedure, and tuning-selected threshold as quantitative evaluation. Figs 6 and 7 display these qualitative outputs; Table 5 identifies the examples. Occlusion maps do not validate clinical lesion localization or causal features.
Examples follow the prespecified true-class and correctness sampling rule; PNEUMONIA is positive, and the threshold is 0.55. Original model inputs and saved overlays are shown. Warm colors indicate larger nonnegative decreases in predicted-class probability, normalized by the maximum decrease within each image; colors are not absolute effect sizes comparable across images. Predictions and maps use the same fixed Task 1 inference transforms.
VIRAL is positive, and the threshold is 0.65. Original model inputs and saved overlays follow the prespecified class-by-correctness sampling rule. The mapped score corresponds to the predicted class, including the erroneous class for a misclassified example. Warm colors indicate larger nonnegative probability decreases, normalized within each image as in Fig 6.
At the default 0.50 threshold, primary Task 1 accuracy was 94.16%, compared with 94.90% at the selected 0.55 threshold. Primary Task 2 accuracy was 74.17% at 0.50 and 77.03% at 0.65; sensitivity declined from 83.90% to 67.80% while specificity increased from 68.84% to 82.09%. Table 6 also reports the selected threshold ±0.05. These observed trade-offs do not imply clinically optimized costs or justify choosing another threshold after inspecting test results.
The actual completed training epochs for all 16 models, including head training and fine-tuning where applicable, are summarized in Table 7.
An asterisk in Table 6 identifies the tuning-selected operating point. Task 1 threshold 0.50 is both the default and the selected threshold minus 0.05, so it appears once. Epoch counts describe completed training, not the index of the selected best epoch. All numerical tables were generated from the existing saved evidence without additional fitting.
Discussion
This study provides a dataset audit and evaluation-design replication using 16 completed models. Task 1 distinguished NORMAL from PNEUMONIA radiographs, whereas Task 2 classified filename-derived BACTERIAL and VIRAL labels. The subtype labels lacked a uniform microbiological reference standard. Thus, the results concern discrimination of dataset-provided labels and do not establish image-only etiologic diagnosis or provide a basis for antibiotic selection. The Task 1 pipeline had higher descriptive performance than Task 2, including five-run mean accuracy of 93.43% versus 77.42% under filename-grouped evaluation. Because the networks, resolutions, augmentation, fine-tuning, and inference procedures differed, these numbers cannot isolate intrinsic task difficulty. No common-architecture sensitivity analysis was performed, and no such controlled claim is made.
An important distinction in this study is between reproducible filename-based grouping and independently verified patient identification. The former can be evaluated directly using the available dataset, whereas the latter requires authoritative image-to-patient linkage that was not available. The study therefore does not assume that filename-derived identifiers represent unique patients. Subtype-qualified grouping prevents the same qualified key from entering multiple generated partitions, while exact-duplicate linkage prevents identical decoded images from crossing those partitions. However, incorporating subtype into the grouping key also means that files sharing a raw person-number prefix but carrying different subtype labels may be assigned to different partitions. Such overlaps cannot be classified as either confirmed patient leakage or confirmed patient independence without additional identity information. Accordingly, the contribution of this analysis is not proof of leakage-free patient-level evaluation, but a transparent examination of how explicit grouping assumptions influence the construction, auditing, and interpretation of deep learning experiments on this dataset. Task 2 should be interpreted as an image-based study of dataset-provided labels. Radiographs alone often cannot determine bacterial versus viral etiology, and treatment implications are outside the evidence generated here [7–9].
The matched Task 2 runs produced a small descriptive mean accuracy difference of −0.46 percentage points for grouped versus image-level evaluation, with variation across seeds. The substantially higher original-folder estimate therefore should not be used as evidence that leakage caused performance inflation. Differences in case mix, class composition, training membership, test difficulty, and other dataset structure remain alternative explanations. Even the controlled comparison is conditional on the filename grouping assumption and does not identify a patient-level causal effect.
Previous research [37] investigated childhood pneumonia classification using a feature-fusion approach combining VGG-19, ResNet-50, and MobileNet-V2 with chi-square feature selection. The main analysis distinguished normal from pneumonia images by combining bacterial and viral pneumonia cases, while an additional three-class experiment distinguished COVID-19, normal, and pneumonia images. The study reported repartitioning and five-fold cross-validation, but its classification endpoints and evaluation procedures differ from the present filename-derived subtype-label task and repeated-holdout design. Thus, the estimates do not support a direct performance ranking. Grouped splitting is established practice; the contribution here is an explicit audit of filename-grouping assumptions and a controlled evaluation-design comparison.
Thresholds are selected by a prespecified statistical rule on tuning data rather than by assumed clinical costs. The sensitivity analysis at 0.50 and small threshold perturbations show how threshold-dependent metrics change without retuning on test data. Clinical utility requires externally validated operating points and decision-analytic evidence.
The revised workflow reports the grouping rule, split construction, positive class, threshold criterion, cluster-bootstrap unit, and derived artifacts required to reproduce each estimate. These details support auditability but do not substitute for external validation.
Limitations and future work
This retrospective study used a single public imaging dataset without an external validation cohort or authoritative patient-identity mapping. Although all filenames were successfully parsed and the implemented grouping and exact-duplicate constraints were audited, these checks cannot establish whether different filename-derived keys belong to the same clinical patient. Residual patient-level dependence may therefore remain across partitions. As a result, the reported test performance and filename-group bootstrap confidence intervals should be interpreted as conditional on the selected grouping definition, not as estimates from independently verified unseen patients. Furthermore, exact decoded-image hashing detects identical image content but cannot identify all near-duplicate images or acquisition-related similarities that could introduce dependence across partitions. The absence of exact-image overlap should therefore not be interpreted as evidence that all forms of image redundancy have been eliminated.
Class weighting avoided row-replication oversampling but did not eliminate memorization or dataset shortcuts. Repeated holdouts overlap, and their descriptive spread is not an estimate from independent cohorts. Bootstrap intervals condition on the selected model, split, and filename groups. The models were not evaluated for clinical utility, prospective triage, antibiotic selection, or population screening.
Future work should use externally curated cohorts with authoritative image-to-patient linkage and etiologic reference standards. Such records would permit an independent audit of patient separation. Sensitivity analyses using alternative filename rules could characterize grouping uncertainty but would not, on their own, establish clinical identity. Multimodal models could incorporate symptoms, oxygenation, laboratory findings and microbiological results. Clinical evaluation would additionally require prespecified operating points, calibration, subgroup assessment, and decision-analytic evidence.
Prospective clinical use would require external multi-institutional validation, prespecified operating thresholds, monitoring for dataset shift, subgroup assessment, and evaluation of clinical impact [23,46,47]. The present study remains an internal dataset audit and evaluation-design replication. If these models were evaluated as interventions in a future clinical trial, the relevant AI-trial reporting extensions would apply [48,49].
Conclusion
Evaluation of 16 models showed strong internal Task 1 dataset-label discrimination and more moderate Task 2 subtype-label discrimination. The controlled five-seed Task 2 means were similar for filename-grouped and image-level partitions, whereas the separate original-folder comparator was higher. These findings do not establish a causal patient-leakage effect. The study contributes a reproducible dataset audit and evaluation-design comparison with explicit filename-parsing rules, duplicate constraints, tuning-only threshold selection, and grouping-conditional uncertainty estimates. These findings demonstrate the importance of defining and reporting grouping assumptions in retrospective medical-imaging AI research, while recognizing that independently verified patient separation and clinical etiologic validity remain beyond the available evidence.
Supporting information
S1 Checklist. CLAIM and STARD-AI reporting checklist for the retrospective chest-radiograph dataset study.
https://doi.org/10.1371/journal.pone.0364142.s001
(DOCX)
S1 File. Analysis notebook, matching Python source, environment requirements, and instructions for reproducing the saved analyses.
https://doi.org/10.1371/journal.pone.0364142.s002
(ZIP)
S1 Dataset. Derived image manifest, parsing and grouping audits, duplicate checks, all 16 split assignments, tuning and test predictions, thresholds and sensitivity tables, run metrics, bootstrap intervals, training histories, configuration records and checksums.
https://doi.org/10.1371/journal.pone.0364142.s003
(ZIP)
S1 Table. Per-seed performance and matched evaluation details, including individual Task 1 and Task 2 results, grouped-minus-image-level paired differences, selected thresholds, and partition counts across five repeated holdouts.
https://doi.org/10.1371/journal.pone.0364142.s004
(DOCX)
References
- 1.
World Health Organization. Pneumonia in children. Geneva: World Health Organization; 2022. Available from: https://www.who.int/news-room/fact-sheets/detail/pneumonia
- 2. Bradley JS, Byington CL, Shah SS, Alverson B, Carter ER, Harrison C, et al. The management of community-acquired pneumonia in infants and children older than 3 months of age: Clinical practice guidelines by the Pediatric Infectious Diseases Society and the Infectious Diseases Society of America. Clin Infect Dis. 2011;53(7):e25-76. pmid:21880587
- 3. McAllister DA, Liu L, Shi T, Chu Y, Reed C, Burrows J, et al. Global, regional, and national estimates of pneumonia morbidity and mortality in children younger than 5 years between 2000 and 2015: A systematic analysis. Lancet Glob Health. 2019;7(1):e47–57. pmid:30497986
- 4. Rudan I, Boschi-Pinto C, Biloglav Z, Mulholland K, Campbell H. Epidemiology and etiology of childhood pneumonia. Bull World Health Organ. 2008;86(5):408–16. pmid:18545744
- 5. Jain S, Williams DJ, Arnold SR, Ampofo K, Bramley AM, Reed C, et al. Community-acquired pneumonia requiring hospitalization among U.S. children. N Engl J Med. 2015;372(9):835–45. pmid:25714161
- 6. Harris M, Clark J, Coote N, Fletcher P, Harnden A, McKean M, et al. British Thoracic Society guidelines for the management of community acquired pneumonia in children: Update 2011. Thorax. 2011;66(Suppl 2):ii1–23.
- 7. O’Grady K-AF, Torzillo PJ, Frawley K, Chang AB. The radiological diagnosis of pneumonia in children. Pneumonia (Nathan). 2014;5(Suppl 1):38–51. pmid:31641573
- 8. Swingler GH. Radiologic differentiation between bacterial and viral lower respiratory infection in children: A systematic literature review. Clin Pediatr (Phila). 2000;39(11):627–33. pmid:11110362
- 9. Virkki R, Juven T, Rikalainen H, Svedström E, Mertsola J, Ruuskanen O. Differentiation of bacterial and viral pneumonia in children. Thorax. 2002;57(5):438–41. pmid:11978922
- 10. LeCun Y, Bengio Y, Hinton G. Deep learning. Nature. 2015;521(7553):436–44. pmid:26017442
- 11. Krizhevsky A, Sutskever I, Hinton GE. ImageNet classification with deep convolutional neural networks. Commun ACM. 2017;60(6):84–90.
- 12. Litjens G, Kooi T, Bejnordi BE, Setio AAA, Ciompi F, Ghafoorian M, et al. A survey on deep learning in medical image analysis. Med Image Anal. 2017;42:60–88. pmid:28778026
- 13. Shin H-C, Roth HR, Gao M, Lu L, Xu Z, Nogues I, et al. Deep convolutional neural networks for computer-aided detection: CNN architectures, dataset characteristics and transfer learning. IEEE Trans Med Imaging. 2016;35(5):1285–98. pmid:26886976
- 14. Gulshan V, Peng L, Coram M, Stumpe MC, Wu D, Narayanaswamy A, et al. Development and validation of a deep learning algorithm for detection of diabetic retinopathy in retinal fundus photographs. JAMA. 2016;316(22):2402–10. pmid:27898976
- 15. Kermany DS, Goldbaum M, Cai W, Valentim CCS, Liang H, Baxter SL, et al. Identifying medical diagnoses and treatable diseases by image-based deep learning. Cell. 2018;172(5):1122-1131.e9. pmid:29474911
- 16.
Rajpurkar P, Irvin J, Zhu K, Yang B, Mehta H, Duan T, et al. CheXNet: Radiologist-level pneumonia detection on chest X-rays with deep learning. arXiv:1711.05225 [Preprint]. 2017. Available from: https://arxiv.org/abs/1711.05225
- 17. Çallı E, Sogancioglu E, van Ginneken B, van Leeuwen KG, Murphy K. Deep learning for chest X-ray analysis: A survey. Med Image Anal. 2021;72:102125. pmid:34171622
- 18.
Wang X, Peng Y, Lu L, Lu Z, Bagheri M, Summers RM. ChestX-ray8: Hospital-scale chest X-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; 2017. p. 2097–106. https://doi.org/10.1109/CVPR.2017.369
- 19.
Irvin J, Rajpurkar P, Ko M, Yu Y, Ciurea-Ilcus S, Chute C, et al. CheXpert: A large chest radiograph dataset with uncertainty labels and expert comparison. arXiv:1901.07031 [Preprint]. 2019. Available from: https://arxiv.org/abs/1901.07031
- 20. Johnson AEW, Pollard TJ, Berkowitz SJ, Greenbaum NR, Lungren MP, Deng C-Y, et al. MIMIC-CXR, a de-identified publicly available database of chest radiographs with free-text reports. Sci Data. 2019;6(1):317. pmid:31831740
- 21. Demner-Fushman D, Kohli MD, Rosenman MB, Shooshan SE, Rodriguez L, Antani S, et al. Preparing a collection of radiology examinations for distribution and retrieval. J Am Med Inform Assoc. 2016;23(2):304–10. pmid:26133894
- 22. Bustos A, Pertusa A, Salinas J-M, de la Iglesia-Vayá M. PadChest: A large chest X-ray image dataset with multi-label annotated reports. Med Image Anal. 2020;66:101797. pmid:32877839
- 23. Zech JR, Badgeley MA, Liu M, Costa AB, Titano JJ, Oermann EK. Variable generalization performance of a deep learning model to detect pneumonia in chest radiographs: A cross-sectional study. PLoS Med. 2018;15(11):e1002683. pmid:30399157
- 24. Willemink MJ, Koszek WA, Hardell C, Wu J, Fleischmann D, Harvey H, et al. Preparing medical imaging data for machine learning. Radiology. 2020;295(1):4–15. pmid:32068507
- 25. Roberts M, Driggs D, Thorpe M, Gilbey J, Yeung M, Ursprung S, et al. Common pitfalls and recommendations for using machine learning to detect and prognosticate for COVID-19 using chest radiographs and CT scans. Nat Mach Intell. 2021;3(3):199–217.
- 26. Packhäuser K, Gündel S, Münster N, Syben C, Christlein V, Maier A. Deep learning-based patient re-identification is able to exploit the biometric nature of medical chest X-ray data. Sci Rep. 2022;12(1):14851. pmid:36050406
- 27.
Jabbour S, Fouhey D, Kazerooni E, Sjoding MW, Wiens J. Deep learning applied to chest X-rays: Exploiting and preventing shortcuts. Proceedings of Machine Learning for Healthcare, vol. 126. PMLR; 2020. p. 750–82.
- 28. DeGrave AJ, Janizek JD, Lee SI. AI for radiographic COVID-19 detection selects shortcuts over signal. Nat Mach Intell. 2021;3(7):610–9.
- 29. Geirhos R, Jacobsen JH, Michaelis C, Zemel R, Brendel W, Bethge M, et al. Shortcut learning in deep neural networks. Nat Mach Intell. 2020;2(11):665–73.
- 30. Oakden-Rayner L. The hidden stratification problem in medical AI. Lancet Digit Health. 2020;2(1):e8–9.
- 31. Mongan J, Moy L, Kahn CE Jr. Checklist for artificial intelligence in medical imaging (CLAIM): A guide for authors and reviewers. Radiol Artif Intell. 2020;2(2):e200029. pmid:33937821
- 32. Tejani AS, Klontzas ME, Gatti AA, Mongan JT, Moy L, Park SH, et al. Checklist for artificial intelligence in medical imaging (CLAIM): 2024 update. Radiol Artif Intell. 2024;6(4):e240300.
- 33. Sounderajah V, Guni A, Liu X, Collins GS, Karthikesalingam A, Markar SR, et al. The STARD-AI reporting guideline for diagnostic accuracy studies using artificial intelligence. Nat Med. 2025;31(10):3283–9. pmid:40954311
- 34. Bossuyt PM, Reitsma JB, Bruns DE, Gatsonis CA, Glasziou PP, Irwig L, et al. STARD 2015: An updated list of essential items for reporting diagnostic accuracy studies. BMJ. 2015;351:h5527. pmid:26511519
- 35. Cohen JF, Korevaar DA, Altman DG, Bruns DE, Gatsonis CA, Hooft L, et al. STARD 2015 guidelines for reporting diagnostic accuracy studies: Explanation and elaboration. BMJ Open. 2016;6(11):e012799. pmid:28137831
- 36. Luo W, Phung D, Tran T, Gupta S, Rana S, Karmakar C, et al. Guidelines for developing and reporting machine learning predictive models in biomedical research: A multidisciplinary view. J Med Internet Res. 2016;18(12):e323. pmid:27986644
- 37. Ouerhani A, Hadidi T, Sahli H, Mahjoubi H. Automatic childhood pneumonia diagnosis based on multi-model feature fusion using chi-square feature selection. J Imaging. 2026;12(2):81. pmid:41745445
- 38. Shorten C, Khoshgoftaar TM. A survey on image data augmentation for deep learning. J Big Data. 2019;6(1):60.
- 39.
Szegedy C, Vanhoucke V, Ioffe S, Shlens J, Wojna Z. Rethinking the inception architecture for computer vision. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; 2016. p. 2818–26. https://doi.org/10.1109/CVPR.2016.308
- 40.
Huang G, Liu Z, van der Maaten L, Weinberger KQ. Densely connected convolutional networks. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; 2017. p. 4700–8. https://doi.org/10.1109/CVPR.2017.243
- 41.
Deng J, Dong W, Socher R, Li LJ, Li K, Fei-Fei L. ImageNet: A large-scale hierarchical image database. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; 2009. p. 248–55. https://doi.org/10.1109/CVPR.2009.5206848
- 42. Russakovsky O, Deng J, Su H, Krause J, Satheesh S, Ma S, et al. ImageNet large scale visual recognition challenge. Int J Comput Vis. 2015;115:211–52.
- 43. Collins GS, Moons KGM, Dhiman P, Riley RD, Beam AL, Van Calster B, et al. TRIPOD+AI statement: Updated guidance for reporting clinical prediction models that use regression or machine learning methods. BMJ. 2024;385:e078378. pmid:38626948
- 44.
Zeiler MD, Fergus R. Visualizing and understanding convolutional networks. In: Fleet D, Pajdla T, Schiele B, Tuytelaars T, editors. Computer Vision - ECCV 2014. Cham: Springer; 2014. p. 818–33. https://doi.org/10.1007/978-3-319-10590-1_53
- 45. Rudin C. Stop explaining black box machine learning models for high stakes decisions and use interpretable models instead. Nat Mach Intell. 2019;1(5):206–15. pmid:35603010
- 46. Kelly CJ, Karthikesalingam A, Suleyman M, Corrado G, King D. Key challenges for delivering clinical impact with artificial intelligence. BMC Med. 2019;17(1):195. pmid:31665002
- 47. Topol EJ. High-performance medicine: The convergence of human and artificial intelligence. Nat Med. 2019;25(1):44–56. pmid:30617339
- 48. Liu X, Cruz Rivera S, Moher D, Calvert MJ, Denniston AK, SPIRIT-AI and CONSORT-AI Working Group. Reporting guidelines for clinical trial reports for interventions involving artificial intelligence: The CONSORT-AI extension. Nat Med. 2020;26(9):1364–74.
- 49. Rivera SC, Liu X, Chan AW, Denniston AK, Calvert MJ, SPIRIT-AI and CONSORT-AI Working Group. Guidelines for clinical trial protocols for interventions involving artificial intelligence: The SPIRIT-AI extension. BMJ. 2020;370:m3210.