2026
CAMELYON17 - Metastasis Detection
Medical AI system for detecting cancerous metastases in histopathological images (H&E). Patch-level classification with CNN (ResNet, EfficientNet) and patient-level aggregation (pN-staging), with Grad-CAM interpretability.

fig. 01 · 224 px H&E patches: normal tissue on top, tumor below
This medical AI research project aims to automatically detect breast cancer metastases in histopathological images (H&E staining) using the CAMELYON17 benchmark dataset. The system performs patch-level classification (224x224 pixels) with CNN architectures (ResNet, EfficientNet), then aggregates results at the patient level for pN-stage classification (pN0 to pN3). The project addresses multi-hospital domain shift (5 sources), class imbalance, and medical interpretability via Grad-CAM and attention visualization. Priority is given to sensitivity to minimize false negatives (missed tumors).
Domain shift across 5 hospitals

fig. 02 · Stain variation across the 5 centers, before normalization (preparation notebook)
The patches come from 5 hospitals with different staining protocols. Per-center RGB histograms show the gap before normalization; the answer is stain normalization plus histopathology-specific augmentations.
Class imbalance

fig. 03 · Class distribution of the CAMELYON17 dataset (exploration notebook)
688,426 normal patches versus 7,392 tumor patches, so the positive class is 1.06%. The imbalance is handled with focal loss, weighted cross-entropy and batch resampling.
EfficientNet training

fig. 04 · Training curves of the multi-center EfficientNet-B2 (training notebook)
Several CNN architectures (ResNet, EfficientNet) are trained with early stopping and checkpointing. Here the multi-center EfficientNet-B2: loss, validation AUC, sensitivity and specificity per epoch, cosine-annealed learning rate.
ROC and PR evaluation

fig. 05 · ROC and precision-recall curves of the best model on the test set (inference notebook)
Evaluation relies on medical metrics: sensitivity, specificity, AUC-ROC. Priority goes to sensitivity to limit false negatives, hence the decision threshold marked on the ROC curve.
Patient-level aggregation

fig. 06 · Per-node aggregation for a pN1 patient (inference notebook)
Patch-level predictions are aggregated per lymph node and then per patient for pN-stage classification (pN0 to pN3). For each patient, the ratio of patches predicted positive per node is compared to the true tumor ratio.
fig. 07

Patch-level confusion matrix: 83 false negatives out of 503 tumor patches, 83.5% sensitivity
fig. 08

A batch rebalanced by WeightedRandomSampler: 14 tumors out of 32 patches
Challenges
- Managing domain shift across 5 source hospitals with different staining protocols
- Severe class imbalance between normal and tumor patches
- Optimizing sensitivity to minimize false negatives (medical criticality)
- Aggregating patch-level predictions to patient-level diagnosis (pN-staging)
Solutions
- Stain normalization and histopathology-specific augmentations
- Focal loss and weighted cross-entropy for class imbalance handling
- ResNet and EfficientNet architectures with early stopping and checkpointing
- Grad-CAM and attention visualization for medical interpretability
Results
- Complete pipeline: exploration → preprocessing → training → evaluation → interpretability
- Domain shift analysis by hospital source
- Medical metrics: sensitivity, specificity, AUC-ROC
- 6 Jupyter notebooks covering the end-to-end pipeline
Technologies
Python · PyTorch · ResNet · EfficientNet · Grad-CAM · OpenCV · Scikit-learn · Plotly