Downloads · 30 days
0
thsEsR5/glioma-survival-transformer
glioma-survival-transformer is a other model from thsEsR5. Use it for the other task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
A multimodal deep learning model for predicting glioma tumor progression from longitudinal post-treatment MRI scans combined with clinical tabular data. The model performs survival analysis to predict:
Downloads · 30 days
0
Access
Public
Updated Apr 25, 2026
Repo size
475 KB
Likes
0
Public
Click a slice to open those files.
.png679 KB · 76%
From the Hugging Face model README
A multimodal deep learning model for predicting glioma tumor progression from longitudinal post-treatment MRI scans combined with clinical tabular data. The model performs survival analysis to predict:
Input: Longitudinal MRI (T×5×64×64×64) + Clinical PCA features (~20-40 dims)
│
├── 3D CNN Encoder (4 blocks: 32→64→128→256 channels, GroupNorm, ReLU, MaxPool3d)
│ → AdaptiveAvgPool3d(1) → 256-dim per timepoint
│ + append [time_gap_months, log(tumor_volume)] → 258-dim
│
├── Input Projection (Linear 258→256, needed for nhead=4 divisibility)
│
├── Temporal Transformer Encoder (2 layers, 4 heads, dim_ff=512)
│ ★ CAUSAL MASKING — each timepoint only attends to itself + past
│ ★ Learnable [CLS] token prepended → 256-dim temporal summary
│
├── Clinical MLP (PCA_dim → 128 → ReLU → LayerNorm → Dropout(0.3) → 64 → ReLU)
│ → 64-dim
│
└── Fusion (Concat 256+64=320 → FC(128) → ReLU → Dropout → FC(64) → ReLU)
├── Hazard Head: FC(64→1), linear — for Cox PH loss
└── BCE Head: FC(64→1) + Sigmoid — auxiliary 12-month classification
Key Design Choices:
MU-Glioma-Post from The Cancer Imaging Archive (TCIA)
| Attribute | Value |
|---|---|
| Patients (total) | 203 |
| Patients with MRI | ~92 |
| MRI timepoints | 617 (2-6 per patient) |
| MRI modalities | T1n, T1c, T2w, T2f + segmentation mask |
| Clinical features | Age, IDH, MGMT, KPS, Grade, Treatment |
| Primary endpoint | Progression-free survival (PFS) |
Two separate data sources:
torch.ampCritical implementation details:
Per timepoint:
.nii.gz via nibabel → float32vol[mask] = (vol[mask] - mean) / (std + 1e-8)(5, 64, 64, 64)Missing modalities → zero-filled (patient/timepoint NOT dropped).
# For each horizon (6mo=180d, 12mo=365d):
if PFS_days <= horizon AND Progression_Event == 1:
label = 1, mask = True # True progression
elif PFS_days > horizon:
label = 0, mask = True # Survived past horizon
else: # PFS < horizon AND event == 0
label = 0, mask = False # CENSORED — excluded from BCE loss
L = L_cox + 0.1 × L_bce
L_cox = -mean[ h_i - log( Σ_{j: t_j ≥ t_i} exp(h_j) ) ] (only uncensored events)
L_bce = BCE(risk_prob, label_12mo) (only non-censored patients)
| Metric | Description |
|---|---|
| C-index | Concordance index via lifelines (primary) |
| AUC-ROC (6mo) | ROC-AUC at 6-month horizon |
| AUC-ROC (12mo) | ROC-AUC at 12-month horizon |
| Brier Score (12mo) | Calibration metric at 12 months |
| Balanced Accuracy | Threshold 0.5, class-balanced |
outputs/plots/)| File | Description |
|---|---|
Glioma_Survival_Pipeline.ipynb | Complete Colab notebook (runs top-to-bottom) |
glioma_survival_pipeline.py | Equivalent Python script |
README.md | This model card |
Glioma_Survival_Pipeline.ipynb in Colab/content/drive/MyDrive/BrainTumor/import torch
ckpt = torch.load('glioma_survival_transformer.pt')
print(ckpt.keys())
# dict_keys(['model_state_dict', 'fold_results', 'best_cindex',
# 'config', 'scaler_params', 'pca_components', ...])
# Reconstruct model
model = MultimodalSurvivalTransformer(clinical_pca_dim=ckpt['pca_components'])
model.load_state_dict(ckpt['model_state_dict'])
@misc{glioma_survival_transformer_2025,
title={Multimodal Longitudinal MRI Survival Transformer for Glioma Progression},
author={ML Research Pipeline},
year={2025},
note={Based on MU-Glioma-Post dataset from TCIA},
url={https://www.cancerimagingarchive.net/collection/mu-glioma-post/}
}