metadata
library_name: transformers
license: apache-2.0
base_model: microsoft/resnet-50
tags:
- image-classification
- pytorch
- resnet
- medical
datasets:
- paultimothymooney/chest-xray-pneumonia
metrics:
- accuracy
- f1
model-index:
- name: resnet-pneumonia-detection
results:
- task:
name: Image Classification
type: image-classification
dataset:
name: imagefolder
type: imagefolder
config: default
split: validation
args: default
metrics:
- name: Accuracy
type: accuracy
value: 0.833
- name: F1
type: f1
value: 0.835
ResNet-50 for Pneumonia Detection
This model is a fine-tuned version of microsoft/resnet-50 trained to classify chest X-ray images into two categories: NORMAL and PNEUMONIA.
It was trained to handle class imbalances using weighted Cross-Entropy loss and utilizes specific image augmentations suited for medical radiography.
Dataset
The model was trained on the Chest X-Ray Images (Pneumonia) dataset.
- Normal: 1,341 training images
- Pneumonia: 3,876 training images
Training Procedure
Preprocessing and Augmentation
Images were resized and normalized using the AutoImageProcessor configuration from the base ResNet-50 model. During training, the following augmentations were applied to improve generalization:
- Random Resized Crop
- Random Horizontal Flip
- Random Rotation (15 degrees)
- Color Jitter (Brightness and Contrast)
Hyperparameters
- Learning Rate: 5e-5
- Train Batch Size: 8
- Gradient Accumulation Steps: 8 (Effective Batch Size: 64)
- Eval Batch Size: 8
- Epochs: 5
- Warmup Ratio: 0.1
- Loss Function: Weighted Cross-Entropy Loss (to penalize minority class misclassifications)
- Optimization Strategy: Best model loaded at the end based on F1 score.
Evaluation Results
On the standard test split, the model achieved the following performance:
- Accuracy: 0.833
- F1 Score (Weighted): 0.835