Update README.md
Browse files
README.md
CHANGED
|
@@ -10,5 +10,57 @@ tags:
|
|
| 10 |
- gradcam
|
| 11 |
- vit
|
| 12 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
|
|
|
|
|
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
- gradcam
|
| 11 |
- vit
|
| 12 |
---
|
| 13 |
+
# π« Pneumonia Detector
|
| 14 |
+

|
| 15 |
+

|
| 16 |
+

|
| 17 |
+

|
| 18 |
|
| 19 |
+
## π― Live Demo
|
| 20 |
+
π [Try it on Hugging Face Spaces](https://huggingface.co/spaces/mou11/pneumonia-detector)
|
| 21 |
|
| 22 |
+
## π Overview
|
| 23 |
+
A medical image classification system that detects pneumonia from chest X-ray images using Vision Transformer (ViT) with Grad-CAM explainability. The model highlights which regions of the X-ray influenced the prediction, making it transparent and trustworthy for medical screening.
|
| 24 |
+
|
| 25 |
+
## π Results
|
| 26 |
+
| Metric | Score |
|
| 27 |
+
|--------|-------|
|
| 28 |
+
| Overall Accuracy | 87% |
|
| 29 |
+
| AUC-ROC | 0.9805 |
|
| 30 |
+
| PNEUMONIA Recall | 1.00 |
|
| 31 |
+
| NORMAL Precision | 0.99 |
|
| 32 |
+
|
| 33 |
+
## π Classification Report
|
| 34 |
+
| Class | Precision | Recall | F1-Score |
|
| 35 |
+
|-------|-----------|--------|----------|
|
| 36 |
+
| NORMAL | 0.99 | 0.66 | 0.79 |
|
| 37 |
+
| PNEUMONIA | 0.83 | 1.00 | 0.91 |
|
| 38 |
+
|
| 39 |
+
## β¨ Features
|
| 40 |
+
- β
Chest X-ray classification: NORMAL vs PNEUMONIA
|
| 41 |
+
- β
Vision Transformer (ViT) fine-tuned on medical images
|
| 42 |
+
- β
Grad-CAM heatmap visualization for explainability
|
| 43 |
+
- β
Handles class imbalance with weighted loss
|
| 44 |
+
- β
Gradio demo for interactive predictions
|
| 45 |
+
|
| 46 |
+
## ποΈ Architecture
|
| 47 |
+
Chest X-Ray Image β Preprocessing (224x224) β ViT Base Patch16 β Fine-tuned Classifier Head β Prediction + Grad-CAM Heatmap
|
| 48 |
+
|
| 49 |
+
## π οΈ Tech Stack
|
| 50 |
+
| Component | Tool |
|
| 51 |
+
|-----------|------|
|
| 52 |
+
| Model | Google ViT Base Patch16 224 |
|
| 53 |
+
| Framework | PyTorch |
|
| 54 |
+
| Explainability | Grad-CAM |
|
| 55 |
+
| Dataset | Chest X-Ray Images (Pneumonia) β Kaggle |
|
| 56 |
+
| UI | Gradio |
|
| 57 |
+
| Training | Google Colab T4 GPU |
|
| 58 |
+
|
| 59 |
+
## π Dataset
|
| 60 |
+
- **Source:** [Chest X-Ray Images (Pneumonia)](https://www.kaggle.com/datasets/paultimothymooney/chest-xray-pneumonia)
|
| 61 |
+
- **Total Images:** 5,863
|
| 62 |
+
- **Classes:** NORMAL (1,341) vs PNEUMONIA (3,875)
|
| 63 |
+
- **Split:** Train / Val / Test
|
| 64 |
+
|
| 65 |
+
## π How to Use
|
| 66 |
+
```python
|