How praneetb2929/ai-medical-diagnosis-system works
This repository is a chest-X-ray pneumonia classifier with a FastAPI prediction API and separate model-training and evaluation workflows. The documented dataset is the Kaggle Chest X-Ray Images (Pneumonia) dataset. The README does not describe a user interface; links to one are omitted. Training weights are loaded and saved by the code but are not present in the tree, so they are represented as external artifacts.
Main entry points: main.py FastAPI endpoints · preprocessing.py Load and transform data · baseline_cnn.py Train baseline CNN · transfer_learning.py Train DenseNet
Components 17
Data preparation
- Load and transform data
data-pipeline/preprocessing.py - Validation split utility
data-pipeline/fix_val_split.py
Model training
- Train baseline CNN
models/baseline_cnn.py - Train DenseNet
models/transfer_learning.py - Baseline CNN
models/baseline_cnn.py - DenseNet121
models/transfer_learning.py
Evaluation and explanation
- Metrics and ROC evaluation
models/evaluate_model.py - Grad-CAM visualization
models/gradcam_viz.py
Prediction API
- FastAPI endpoints
app/main.py - Inference image transform
app/main.py - Dual-model inference
app/main.py - Prediction heatmaps
app/main.py - Reported metrics
app/main.py
Other components
- Image user
- Chest X-ray dataset
- Saved model weights
- Predictions and overlays
Connections 24
- Chest X-ray dataset → Load and transform data: provides images
- Chest X-ray dataset → Validation split utility: source split
- Validation split utility → Chest X-ray dataset: moves validation images
- Load and transform data → Train baseline CNN: provides loaders
- Load and transform data → Train DenseNet: provides loaders
- Train baseline CNN → Baseline CNN: trains
- Train DenseNet → DenseNet121: trains
- Train baseline CNN → Saved model weights: saves baseline weights
- Train DenseNet → Saved model weights: saves DenseNet weights
- Load and transform data → Metrics and ROC evaluation: provides test loader
- Saved model weights → Metrics and ROC evaluation: loads DenseNet weights
- Load and transform data → Grad-CAM visualization: provides test loader
- Saved model weights → Grad-CAM visualization: loads DenseNet weights
- Image user → FastAPI endpoints: uploads X-ray
- FastAPI endpoints → Inference image transform: decodes image
- Inference image transform → Dual-model inference: supplies tensor
- Saved model weights → FastAPI endpoints: loads both models
- FastAPI endpoints → Dual-model inference: runs prediction
- Dual-model inference → Prediction heatmaps: generates heatmaps
- FastAPI endpoints → Reported metrics: serves metrics
- FastAPI endpoints → Predictions and overlays: returns response
- Dual-model inference → Predictions and overlays: supplies predictions
- Prediction heatmaps → Predictions and overlays: supplies overlays
- Image user → Predictions and overlays: receives response