Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
tags:
|
| 4 |
+
- chest-xray
|
| 5 |
+
- image-classification
|
| 6 |
+
- pneumonia
|
| 7 |
+
- resnet18
|
| 8 |
+
- computer-vision
|
| 9 |
+
- medical-imaging
|
| 10 |
+
license: mit
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# E03 ResNet18 Scheduler - Chest X-Ray Classification
|
| 14 |
+
|
| 15 |
+
## Overview
|
| 16 |
+
|
| 17 |
+
This project develops a deep learning image classification model for
|
| 18 |
+
classifying chest X-ray images into two classes:
|
| 19 |
+
|
| 20 |
+
- NORMAL
|
| 21 |
+
- PNEUMONIA
|
| 22 |
+
|
| 23 |
+
The model uses a pretrained ResNet18 architecture with transfer learning
|
| 24 |
+
and a StepLR learning-rate scheduler.
|
| 25 |
+
|
| 26 |
+
This project was developed as part of an AI Engineering Bootcamp final
|
| 27 |
+
portfolio project.
|
| 28 |
+
|
| 29 |
+
## Model
|
| 30 |
+
|
| 31 |
+
- Architecture: ResNet18
|
| 32 |
+
- Framework: PyTorch
|
| 33 |
+
- Pretrained weights: ImageNet
|
| 34 |
+
- Number of classes: 2
|
| 35 |
+
- Optimizer: Adam
|
| 36 |
+
- Initial learning rate: 0.0001
|
| 37 |
+
- Batch size: 32
|
| 38 |
+
- Epochs: 5
|
| 39 |
+
- Loss function: CrossEntropyLoss with class weights
|
| 40 |
+
- Scheduler: StepLR
|
| 41 |
+
- Scheduler step size: 2
|
| 42 |
+
- Scheduler gamma: 0.1
|
| 43 |
+
|
| 44 |
+
## Classes
|
| 45 |
+
|
| 46 |
+
1. NORMAL
|
| 47 |
+
2. PNEUMONIA
|
| 48 |
+
|
| 49 |
+
## Test Results
|
| 50 |
+
|
| 51 |
+
The final E03 model achieved:
|
| 52 |
+
|
| 53 |
+
| Metric | Score |
|
| 54 |
+
|---|---:|
|
| 55 |
+
| Test Accuracy | 92.31% |
|
| 56 |
+
| Weighted F1-score | 92.16% |
|
| 57 |
+
| Macro F1-score | 91.50% |
|
| 58 |
+
|
| 59 |
+
### Classification Report
|
| 60 |
+
|
| 61 |
+
| Class | Precision | Recall | F1-score |
|
| 62 |
+
|---|---:|---:|---:|
|
| 63 |
+
| NORMAL | 0.9697 | 0.8205 | 0.8889 |
|
| 64 |
+
| PNEUMONIA | 0.9014 | 0.9846 | 0.9412 |
|
| 65 |
+
|
| 66 |
+
### Confusion Matrix
|
| 67 |
+
|
| 68 |
+
Actual NORMAL: 192 NORMAL, 42 PNEUMONIA
|
| 69 |
+
|
| 70 |
+
Actual PNEUMONIA: 6 NORMAL, 384 PNEUMONIA
|
| 71 |
+
|
| 72 |
+
## Methodology
|
| 73 |
+
|
| 74 |
+
The model was developed using transfer learning with a pretrained
|
| 75 |
+
ResNet18 network. The final fully connected layer was replaced with a
|
| 76 |
+
two-class classification layer.
|
| 77 |
+
|
| 78 |
+
The training process used:
|
| 79 |
+
|
| 80 |
+
1. Image preprocessing and dataset preparation
|
| 81 |
+
2. Train/validation/test split
|
| 82 |
+
3. ResNet18 pretrained on ImageNet
|
| 83 |
+
4. Weighted cross-entropy loss
|
| 84 |
+
5. Adam optimizer
|
| 85 |
+
6. StepLR learning-rate scheduling
|
| 86 |
+
7. Five training epochs
|
| 87 |
+
8. Best-model selection based on validation loss
|
| 88 |
+
9. Evaluation on a held-out test set
|
| 89 |
+
|
| 90 |
+
## Intended Use
|
| 91 |
+
|
| 92 |
+
This model is intended for educational and experimental purposes,
|
| 93 |
+
particularly for demonstrating computer vision and transfer learning
|
| 94 |
+
workflows.
|
| 95 |
+
|
| 96 |
+
It should NOT be used as a medical diagnostic system or as a substitute
|
| 97 |
+
for professional medical assessment.
|
| 98 |
+
|
| 99 |
+
## Limitations
|
| 100 |
+
|
| 101 |
+
The model was trained and evaluated on a specific chest X-ray dataset.
|
| 102 |
+
Its performance may not generalize to images from different hospitals,
|
| 103 |
+
devices, patient populations, or acquisition protocols.
|
| 104 |
+
|
| 105 |
+
The model should therefore not be used for clinical decision-making
|
| 106 |
+
without appropriate external validation, clinical testing, regulatory
|
| 107 |
+
review, and professional oversight.
|
| 108 |
+
|
| 109 |
+
## Model File
|
| 110 |
+
|
| 111 |
+
The trained model weights are provided in:
|
| 112 |
+
|
| 113 |
+
E03_ResNet18_Scheduler_best.pth
|
| 114 |
+
|
| 115 |
+
## Author
|
| 116 |
+
|
| 117 |
+
Bunsya
|
| 118 |
+
|
| 119 |
+
AI Engineering Bootcamp - Final Portfolio Project
|