Model Card: Model Card: Dual-Input ResNet50 for Cervical Cancer Image Classification
This model uses both Pre- and Post-stained cervical images as input and employs ResNet50 backbones with attention for feature fusion. It performs binary classification (Negative vs Positive).
Model Details
- Developed by: Beijuka / Pathogen Lab
- Funded by: STI
- Model type: Convolutional Neural Network (CNN)
- Input type: images (244x244)
- Output type: Binary classification (Negative, Positive)
- License: MIT
- Finetuned from:
microsoft/resnet-50
Uses
Direct Use
- classification of cervical cancer images into Negative vs Positive cases.
Downstream Use
- Could be integrated into diagnostic support pipelines.
- Adapted for related medical imaging classification tasks.
Out-of-Scope Use
- Not a replacement for professional medical diagnosis.
- Should not be deployed clinically without regulatory approval.
- Not suitable for non-cervical images.
Bias, Risks, and Limitations
- The dataset was unbalance (class distribution imbalance).
- Model performance varies by threshold (see below).
- Limited dataset size means results may not generalize.
Recommendations
- Validate on larger, more diverse datasets.
- Carefully calibrate decision threshold depending on application (screening vs confirmatory).
- Use alongside clinical expertise, not as a standalone tool.
How to Get Started
from huggingface_hub import hf_hub_download
from tensorflow import keras
model_path = hf_hub_download(
"Beijuka/cancer-resnet50-dual-input",
"best_resnet50_prepost.h5"
)
model = keras.models.load_model(model_path)
Training Details
Training Data
Dual histopathology images (Pre-stained and Post-stained) of cervical cancer (RGB).
** Preprocessing:
** Resize to 224x224
** Normalize using tensorflow.keras.applications.resnet50.preprocess_input
** Augment training data with horizontal flips, brightness/contrast, rotation, and shift/scale/rotate transformations.
Training Procedure
- Optimizer: Adam
- Loss: Binary Crossentropy
- Batch size: 16 (initial), 8 (fine-tuning)
- Learning rate: 1e-4 (initial), 1e-5 (fine-tuning)
- Epochs: 30 (initial), 20 (fine-tuning)
- Callbacks: EarlyStopping, ModelCheckpoint, ReduceLROnPlateau
Data Splits (70:20:10)
- all splits contain both pre- and post-stained images
| Split | Total | Negative | Positive |
|---|---|---|---|
| Training | 338 | 304 | 34 |
| Validation | 96 | 86 | 10 |
| Test | 49 | 45 | 4 |
Hardware
- GPU: Tesla T4 (14GB)
- CUDA Version: 12.4
- Software: TensorFlow/Keras
Evaluation
Testing Data
Independent test set: 49 images (45 Negative, 4 Positive)
Input: dual images (pre-stained and post-stained)
Metrics at Threshold 0.5
Classification Report
precision recall f1-score support
Negative 0.94 0.95 0.95 309
Positive 0.44 0.38 0.41 29
accuracy 0.91 338
macro avg 0.69 0.67 0.68 338
weighted avg 0.90 0.91 0.90 338
Overall Metrics
- Accuracy: 0.91
- Precision (Positive class): 0.44
- Recall (Positive class): 0.3793
- F1-Score (Positive class): 0.41
Confusion Matrix
[[45, 0],
[ 3, 1]]
Sensitivity / Specificity
Sensitivity (Positive) = 0.25
Specificity (Negative) = 1.00
Threshold Analysis
- Lower thresholds (โค0.35) favor recall โ more positives detected but many false positives.
- Mid-range thresholds (0.40โ0.50) balance accuracy and F1.
- Higher thresholds (>0.65) โ model collapses to predicting only one class
| Threshold | Accuracy | Precision | Recall | F1 |
|---|---|---|---|---|
| 0.00 | 0.0816 | 0.0816 | 1.0000 | 0.1509 |
| 0.05 | 0.0816 | 0.0816 | 1.0000 | 0.1509 |
| 0.10 | 0.1020 | 0.0833 | 1.0000 | 0.1538 |
| 0.15 | 0.1837 | 0.0909 | 1.0000 | 0.1667 |
| 0.20 | 0.2245 | 0.0952 | 1.0000 | 0.1739 |
| 0.25 | 0.4286 | 0.1000 | 0.7500 | 0.1765 |
| 0.30 | 0.5918 | 0.1364 | 0.7500 | 0.2308 |
| 0.35 | 0.7347 | 0.2000 | 0.7500 | 0.3158 |
| 0.40 | 0.8367 | 0.3000 | 0.7500 | 0.4286 |
| 0.45 | 0.8980 | 0.4000 | 0.5000 | 0.4444 |
| 0.50 | 0.9388 | 1.0000 | 0.2500 | 0.4000 |
| 0.55 | 0.9388 | 1.0000 | 0.2500 | 0.4000 |
| 0.60 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
| 0.65 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
| 0.70 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
| 0.75 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
| 0.80 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
| 0.85 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
| 0.90 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
| 0.95 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
| 1.00 | 0.9184 | 0.0000 | 0.0000 | 0.0000 |
Technical Specifications
Model Architecture
Dual ResNet50 backbones for pre- and post-stained images
Multi-Head Attention to fuse pre/post features
Final Dense layer with sigmoid activation for binary output
Trained using TensorFlow/Keras, with attention-based feature fusion
Compute Infrastructure
- Hardware: Tesla T4 GPU
- Software: TensorFlow/Keras
Model tree for emergentai/cancer-resnet50-dual-input
Base model
microsoft/resnet-50