A medical imaging classifier built by fine-tuning a ResNet-18 backbone on X-ray data. Includes GPU-optimized training, augmentation pipelines, transfer learning, and evaluation scripts useful for healthcare AI prototyping.
Run a single-image inference demo:
pip install -r requirements.txt
python demo_predict.pyThis demonstrates preprocessing, feature extraction, and final classification.
Train the full ResNet-18 classifier:
python train_resnet18_xray.pyIncludes:
- Frozen → unfrozen training phases
- Augmentations (resize, normalize, flips)
- ImageFolder dataset loading
- Accuracy reporting
- Transfer learning best practices
train_resnet18_xray.py # Full transfer-learning training script
demo_predict.py # Example inference on a sample X-ray
requirements.txt # Dependencies
The pipeline uses:
- Pretrained ResNet-18 backbone
- Custom classification head
- Cross-entropy loss
- Optional mixed precision
- Data augmentations for robustness
This repo demonstrates applied computer vision engineering for medical imaging tasks.
.
├── train_resnet18_xray.py
├── run_demo.py
├── requirements.txt
├── CONTRIBUTING.md
└── SECURITY.md
At a high level, the training system looks like this:
Input images (H x W x 3)
|
torchvision.transforms
- Resize to 224x224
- Data augmentation
- Normalization
|
v
Pretrained ResNet-18 backbone
|
+--> Convolution + Residual Blocks
|
v
Global Average Pooling
|
v
Fully-connected classification head
(replaced with num_classes = 2)
|
v
Softmax (via CrossEntropyLoss)
See CONTRIBUTING.md for contribution guidelines.
MIT License. See LICENSE for details.