# PneumoNet: Artificial Intelligence Assistance for Pneumonia Detection on X-Rays
## 3 Pneumonet Framework
### XAI Module
If miscalibration is detected, techniques such as Platt scaling or isotonic regression could be applied to adjust the model's probability outputs, ensuring they accurately reflect true risks. Furthermore, integrating calibration results into the Medical Report Module's outputs via the use of the LLM (GPT-Neo) would enhance transparency, enabling clinicians to interpret confidence scores with greater trust. These improvements would mitigate the risk of misleading confidence scores, strengthen PneumoNet's clinical applicability, and ensure its predictions are both technically robust and aligned with real-world diagnostic needs. A third limitation of the PneumoNet framework is its inability to differentiate between bacterial and viral pneumonia, which introduces diagnostic ambiguity critical to clinical decision-making due to their distinct treatment pathways. To address this limitation, future iterations of PneumoNet should aim to incorporate multi-class classification to distinguish between bacterial, viral, and other pneumonia types, leveraging datasets with aetiology-specific labels. Enhancements could include training on radiological features associated with bacterial (e.g., lobar consolidation) versus viral (e.g., bilateral interstitial infiltrates) pneumonia, potentially using advanced architectures or feature engineering. Additionally, integrating clinical metadata, such as white blood cell counts or procalcitonin levels, which differ between bacterial and viral infections, could improve differentiation. The MRM could be updated to reflect these distinctions, enabling the LLM to generate reports that highlight the likely pneumonia type and associated treatment implications. By benchmarking PneumoNet against other state-of-the-art models, its strengths in accuracy, scalability, and real-world applicability were established. Additionally, analysing misclassified cases and employing visualisation techniques provided a deeper understanding of the model's performance, leading to potential areas for further refinement. The current PneumoNet framework is designed for binary classification of chest X-ray images(normal vs. pneumonia), as implemented in the provided code with a fully connected layer outputting two classes, limiting its scope to pneumonia detection without differentiating other pulmonary conditions such as tuberculosis or COVID-19. This focus, while effective for pneumonia with high accuracy (e.g., 98.70% on Dataset #2 [9]), restricts the model's ability to address multi-disease scenarios common in clinical settings, where distinguishing between pneumonia, tuberculosis (characterised by cavitary lesions or lymphadenopathy), and COVID-19 (often showing ground-glass opacities) is critical for accurate diagnosis and treatment. The absence of multi-disease testing reduces PneumoNet's applicability in complex diagnostic environments, as the datasets [8; 9; 10] used for training and evaluation primarily focus on pneumonia labels, with Dataset #1 [8], including some COVID-19 cases but not explicitly addressing multi-class differentiation in the current model design. Future work on PneumoNet plans to expand its capabilities to include multi-disease testing, specifically targeting the differentiation of pneumonia, tuberculosis, and COVID-19, as part of the authors' intention to develop a new explainable AI (XAI) model for COVID-19 detection on X-rays. This will involve curating or leveraging datasets with multi-disease annotations, such as enhanced versions of Dataset #1 [8], which include COVID-19 cases, or new datasets with tuberculosis labels, to train a multi-class classification model. The model architecture could be extended to incorporate additional output neurones in the fully connected layer and utilise advanced XAI techniques to highlight disease-specific radiological features. Integrating these capabilities into the Medical Report Module would enable GPT-Neo to generate detailed reports distinguishing between diseases, enhancing clinical utility.