library_name: pytorch
tags:
- chest-xray
- image-classification
- pneumonia
- resnet18
- computer-vision
- medical-imaging
license: mit
E03 ResNet18 Scheduler - Chest X-Ray Classification
Overview
This project develops a deep learning image classification model for classifying chest X-ray images into two classes:
- NORMAL
- PNEUMONIA
The model uses a pretrained ResNet18 architecture with transfer learning and a StepLR learning-rate scheduler.
This project was developed as part of an AI Engineering Bootcamp final portfolio project.
Model
- Architecture: ResNet18
- Framework: PyTorch
- Pretrained weights: ImageNet
- Number of classes: 2
- Optimizer: Adam
- Initial learning rate: 0.0001
- Batch size: 32
- Epochs: 5
- Loss function: CrossEntropyLoss with class weights
- Scheduler: StepLR
- Scheduler step size: 2
- Scheduler gamma: 0.1
Classes
- NORMAL
- PNEUMONIA
Test Results
The final E03 model achieved:
| Metric | Score |
|---|---|
| Test Accuracy | 92.31% |
| Weighted F1-score | 92.16% |
| Macro F1-score | 91.50% |
Classification Report
| Class | Precision | Recall | F1-score |
|---|---|---|---|
| NORMAL | 0.9697 | 0.8205 | 0.8889 |
| PNEUMONIA | 0.9014 | 0.9846 | 0.9412 |
Confusion Matrix
Actual NORMAL: 192 NORMAL, 42 PNEUMONIA
Actual PNEUMONIA: 6 NORMAL, 384 PNEUMONIA
Methodology
The model was developed using transfer learning with a pretrained ResNet18 network. The final fully connected layer was replaced with a two-class classification layer.
The training process used:
- Image preprocessing and dataset preparation
- Train/validation/test split
- ResNet18 pretrained on ImageNet
- Weighted cross-entropy loss
- Adam optimizer
- StepLR learning-rate scheduling
- Five training epochs
- Best-model selection based on validation loss
- Evaluation on a held-out test set
Intended Use
This model is intended for educational and experimental purposes, particularly for demonstrating computer vision and transfer learning workflows.
It should NOT be used as a medical diagnostic system or as a substitute for professional medical assessment.
Limitations
The model was trained and evaluated on a specific chest X-ray dataset. Its performance may not generalize to images from different hospitals, devices, patient populations, or acquisition protocols.
The model should therefore not be used for clinical decision-making without appropriate external validation, clinical testing, regulatory review, and professional oversight.
Model File
The trained model weights are provided in:
E03_ResNet18_Scheduler_best.pth
Author
Bunsya
AI Engineering Bootcamp - Final Portfolio Project