How badivana/chest-x-ray-classification works
This repository is a chest X-ray classifier project: its documented workflow trains and evaluates a model, then classifies new images; Grad-CAM can explain a prediction with a heatmap. The README describes preprocessing, augmentation, and ResNet50 transfer learning, while scr/gradcam.py defines a custom CNN for inference, so those model descriptions may reflect different or outdated implementations. Training notebook internals were not sampled; its relationships are shown only where the README documents them.
Main entry points: gradcam.py Grad-CAM CLI · train_model.ipynb Train and evaluate · best_model.pth Trained weights · dataset X-ray dataset
Components 12
Model Development
- Train and evaluate
train_model.ipynb - X-ray dataset
dataset - Trained weights
best_model.pth
Prediction
- Grad-CAM CLI
scr/gradcam.py - CNN model
scr/gradcam.py - Image preprocessing
scr/gradcam.py - Class prediction
scr/gradcam.py
Explainability
- Grad-CAM heatmap
scr/gradcam.py - Heatmap overlay
scr/gradcam.py
Other components
- Image user
- X-ray image
- Class and overlay
Connections 13
- X-ray dataset → Train and evaluate: trains on
README.md - Train and evaluate → Trained weights: produces weights
README.md - Image user → Grad-CAM CLI: runs
README.md - X-ray image → Grad-CAM CLI: supplies image
README.md - Grad-CAM CLI → CNN model: loads weights
scr/gradcam.py - Trained weights → CNN model: provides weights
scr/gradcam.py - Grad-CAM CLI → Image preprocessing: calls
scr/gradcam.py - Image preprocessing → Class prediction: returns tensor
scr/gradcam.py - Grad-CAM CLI → Grad-CAM heatmap: runs explanation
scr/gradcam.py - Grad-CAM heatmap → CNN model: queries
scr/gradcam.py - Grad-CAM CLI → Heatmap overlay: creates overlay
scr/gradcam.py - Class prediction → Class and overlay: reports class
scr/gradcam.py - Heatmap overlay → Class and overlay: saves image
scr/gradcam.py