Dataset
The study used a controlled dataset of 5,891 unique chest X-rays assembled from three Kaggle sources. Exact duplicates were removed using SHA256 hashing. Labels were normalized to three classes: Normal, Bacterial Pneumonia, and Viral Pneumonia.
The dataset was split into 70% training, 15% validation, and 15% test, with stratification by class.
Classification Results
Three-Class Classification
Normal vs Bacterial vs ViralPer-class precision, recall, and F1 are pending final evaluation.
Binary Pneumonia Detection
Normal vs PneumoniaPer-class precision, recall, and F1 are pending final evaluation.
Pneumonia Subtype Classification
Bacterial vs ViralPer-class precision, recall, and F1 are pending final evaluation.
Confusion Matrices
Confusion matrices are placeholders pending final runs. The matrices below show the intended structure; numeric values will be populated from the final evaluation outputs.
Why Hierarchical Classification?
A single three-class classifier struggled to separate all categories in one step, especially the viral class. In contrast, the binary pneumonia detector reached 93.78% accuracy, while subtype classification remained harder at about 75.67%.
The hierarchical design mirrors these results: first decide whether pneumonia is present, then classify the subtype only when needed. This keeps the stronger signal (Normal vs Pneumonia) primary and isolates the harder decision to cases where it actually matters.
Ensemble Strategy
The codebase includes soft voting and weighted soft voting utilities for combining probabilities across multiple models (MobileNet, EfficientNet, ResNet). Ensembles remain a research direction and may improve robustness, but the production API exposes a stable hierarchical prediction contract regardless of the underlying model configuration.
Future work includes ROC/AUC analysis, sensitivity and specificity reporting, calibration analysis, threshold tuning, and external validation on unseen datasets.
Limitations
- The raw datasets are not included in the repository due to size.
- Split CSVs may contain machine-specific file paths and should be regenerated for new environments.
- Some experiment scripts under
experiments/research_scripts/are legacy research scripts and should be consolidated before production use. - Three-class bacterial-versus-viral classification remains challenging.
- The project is not a certified medical diagnostic system.
- Confusion matrices and per-class metrics are placeholders pending final evaluation runs.