Dual-head hybrid CNN-Transformer for brain tumor MRI, leave-one-dataset-out
Weights for the paper Pretraining, Not Architecture, Determines Cross-Institutional Generalization in Brain Tumor MRI Classification.
Code: https://github.com/Ats-Tewe/brain-tumor-lodo
What is here
Four checkpoints, seed 42 throughout. Each is the selected checkpoint, not the last epoch, so each corresponds to a number in the paper.
| file | protocol | held out | accuracy |
|---|---|---|---|
merged_best_model.pth |
Merged baseline | nothing | 99.68% |
lodo1_best_model.pth |
LODO Round 1 | Kaggle | 94.25% |
lodo2_best_model.pth |
LODO Round 2 | Figshare | 99.34%, three classes |
lodo3_best_model.pth |
LODO Round 3 | Mendeley | 94.12% |
lodo3 is the model behind every calibration, uncertainty and explanation
result in the paper.
Loading
import torch
from huggingface_hub import hf_hub_download
path = hf_hub_download("Ha-Te-21/brain-tumor-lodo", "lodo3_best_model.pth")
state = torch.load(path, map_location="cpu")
model.load_state_dict(state.get("model_state_dict", state))
model.eval()
The model class is src/model/model.py in the code repository.
Two things that will bite you
Input is 320 px, not 224. The images are stored at 224 and upsampled at load time. Feeding 224 directly changes the token grid from 10x10 to 7x7 and the position embeddings will not match.
Normalization is ImageNet statistics, not per-image. See
src/common/data.py.
What these weights are good for, and what they are not
They reproduce the numbers in the paper. They are not a clinical tool.
The paper's own finding is that five runs of this configuration, differing only in random seed, spanned 12.99 accuracy points on a held-out institution. A single checkpoint is one draw from that distribution. Round 2 in particular evaluates three classes on a test set that is 78% glioma, with its meningioma estimate resting on 58 images; we exclude it from every cross-institutional conclusion and so should you.
Verifying your download
SHA256SUMS is in this repository.
sha256sum -c SHA256SUMS
Citation
See CITATION.cff in the code repository.