AI-Powered Multi-Disease Chest X-Ray Analysis And Explainable AI System Using Densenet121 and Grad-Cam
Abstract
Chest X-ray imaging is widely used for examining abnormalities associated with the lungs and respiratory system. The increasing availability of medical image datasets has created opportunities for applying deep learning techniques to assist in the preliminary analysis of chest radiographs. However, classification of different chest conditions within a single system and interpretation of the resulting predictions remain important challenges. This paper presents an AI-Powered Multi-Disease Chest X-Ray Analysis System for classifying chest X-ray images into four categories: COVID-19, Normal, Pneumonia, and Tuberculosis. The implemented system uses a DenseNet121-based transfer learning model for multi-class image classification. The dataset consists of approximately 7,135 chest X-ray images organized into training, validation, and testing sets. The input images are resized to 224 × 224 pixels before classification. The model produces class-wise probability values, and the class with the highest probability is presented as the predicted category. To improve the interpretability of the model output, Gradient-weighted Class Activation Mapping (Grad-CAM) is integrated into the system. Grad-CAM uses gradient information associated with a target class to generate a visual heatmap highlighting image regions that contributed to the model's prediction. A basic image-validation mechanism is also included to reject obviously unsuitable inputs before the prediction process. The trained DenseNet121 model achieved approximately 90.93% training accuracy and 84.21% validation accuracy after 10 epochs. The trained model was integrated into a Flask-based web application, allowing users to upload chest X-ray images and view the predicted class, model confidence, class-wise probabilities, original X-ray image, and corresponding Grad-CAM visualization. The implemented prototype demonstrates the feasibility of combining multi-class chest X-ray classification with explainable artificial intelligence within a single web-based system.