Stochastic Siamese MAE Pretraining for Longitudinal Medical Images
Authors: Taha Emre, Arunava Chakravarty, Thomas Pinetz, Dmitrii Lachinov, Martin J. Menten, Hendrik Scholl, Sobha Sivaprasad, Daniel Rueckert, +4 more
Organizations: Institute of Artificial Intelligence, Center for Medical Data Science, Medical University of Vienna, Austria · Department of Ophthalmology and Optometry, Medical University of Vienna, Austria · BioMedIA, Department of Computing, Imperial College London, London, United Kingdom · Chair for AI in Healthcare and Medicine, Technical University of Munich, Munich, Germany · Department of Clinical Pharmacology, Medical University of Vienna, Vienna, Austria · Pallas Kliniken AG, Pallas Klinik Zürich, Zürich, Switzerland · European Vision Institute, Basel, Basel-Stadt, Switzerland · Moorfields National Institute for Health and Care Biomedical Research Centre, Moorfields Eye Hospital, London, United Kingdom · Institute of Ophthalmology, University College London, London, United Kingdom · Faculty of Medicine, University of Southampton, Southampton, Hampshire, United Kingdom · Ophthalmic Image Analysis Group (OPTIMA), Medical University of Vienna, Austria
Temporally aware image representations are crucial for capturing disease progression in 3D volumes of longitudinal medical datasets. However, recent state-of-the-art self-supervised learning approaches like Masked Autoencoding (MAE), despite their strong representation learning capabilities, lack temporal awareness. In this paper, we propose STAMP (Stochastic Temporal Autoencoder with Masked Pretraining), a Siamese MAE framework that encodes temporal information through a stochastic process by conditioning on the time difference between the 2 input volumes. Unlike deterministic Siamese approaches, which compare scans from different time points but fail to account for the inherent uncertainty in disease evolution, STAMP learns temporal dynamics stochastically by reframing the MAE reconstruction loss as a conditional variational inference objective. We evaluated STAMP on two OCT and one MRI datasets with multiple visits per patient. STAMP pretrained ViT models outperformed both existing temporal MAE methods and foundation models on different late stage Age-Related Macular Degeneration and Alzheimer's Disease progression prediction which require models to learn the underlying non-deterministic temporal dynamics of the diseases.
Figures & tables
Fig. 1: Top : HARBOR dataset for wet-AMD conversion from iAMD, arrow pointing the subretinal fluid. Middle : PINNACLE dataset for GA conversion from iAMD, arrow pointing increasing light transmission due to atrophy. Bottom : ADNI dataset, CN to MCI to AD with difference map, red/green means decrease/increase in pixel intensity.
Fig. 2: An overview of STAMP. Two 3D volumes ( xt and xt+Δt ) Δt apart from a patient are used as input. After patchifying both scans, only the future visit is masked ( x~t+Δt ) and a learnable CLS token is attached to both branches. TE and the subsequent summation indicate Temporal Encoding ( TE ) added to the CLS token with Δt prompting in xt branch. A ViT-based encoder f embeds the past visit and visible patches of the future into ht and h~t+Δt . For the stochasticity, the posterior ( qϕ ) is learned from the embeddings CLSt and CLSt+Δt of the partially visible future, while the prior ( pψ ) is learned from CLSt and TE . After sampling stochastic embedding ( SE ) ( z^t+Δt ) from the posterior qϕ , a cross-attention-based decoder queries h~t+Δt against [z^t+Δt,ht] to reconstruct the future visit ( x^t+Δt ). Once pretrained, the components within the dashed blue line are available during inference for the downstream task. ∼▹ indicates sampling operation.
Fig. 3: Intra-visit intervals of ADNI dataset. Dashed lines indicate 1-, 2-, and 3-years.
Dataset
Class
# of Patients
# of Visits
Interval (months)
HARBOR
pretraining
579
12770
1.0±1.0
iAMD → iAMD
431
8141
iAMD → wet-AMD
117
1967
PINNACLE
iAMD → iAMD
451
4260
3.2±3.3
iAMD → GA
99
621
ADNI
CN → CN
584
2665
12.9±8.5
TABLE I: Statistics of the datasets. Disease pathways are defined as a detected conversion during the study.
Pretraining
Downstream
6-months
12-months
SE
TE
SE
TE
AUROC ↑
PRAUC ↑
BACC ↑
AUROC ↑
PRAUC ↑
BACC ↑
1
✗
✓
-
✗
0.634±0.019
0.111±0.019
0.587±0.012
0.602±0.064
0.156±0.039
0.564±0.052
2
✗
✓
-
✓
0.675±0.043
0.120±0.028
0.612±0.036
0.640±0.053
0.188±0.041
0.591±0.033
3
✓
✗
✗
-
0.637±0.048
0.100±0.017
0.592±0.028
0.601±0.038
0.138±0.011
0.571±0.033
4
✓
✗
✓
-
0.627±0.033
0.088±0.015
0.579±0.016
0.602±0.028
0.134±0.012
0.561±0.024
5
✓
✓
✗
✓
0.690±0.036
0.127±0.027
0.612±0.043
0.652±0.061
0.180±0.063
0.601±0.052
TABLE II: Ablation for the proposed temporal (TE) and stochastic (SE) components during pretraining and the downstream task on the HARBOR dataset. Row 7 corresponds to STAMP. In the Pretraining column, (✗) indicates a method without the component. In the Downstream column, (✗) indicates a component added in the pretraining but not used in the downstream task. PRAUC baselines for 6 and 12 months are 0.05 and 0.11, respectively.
Pretraining
Downstream
1-year
3-years
SE
TE
SE
TE
AUROC ↑
PRAUC ↑
BACC ↑
AUROC ↑
PRAUC ↑
BACC ↑
1
✗
✓
-
✗
0.751±0.002
0.195±0.002
0.699±0.002
0.746±0.001
0.372±0.001
0.696±0.005
2
✗
✓
-
✓
0.779±0.001
0.214±0.002
0.702±0.012
0.762±0.006
0.362±0.016
0.665±0.019
3
✓
✗
✗
-
0.770±0.006
0.300±0.014
0.692±0.005
0.795±0.002
0.438±0.005
0.714±0.002
4
✓
✗
✓
-
0.787±0.001
0.248±0.004
0.698±0.006
0.799±0.002
0.460±0.002
0.710±0.016
5
✓
✓
✗
✓
0.799±0.001
0.269±0.002
0.698±0.003
0.771±0.007
0.398±0.021
0.693±0.010
TABLE III: Ablation for the proposed temporal (TE) and stochastic (SE) components during pretraining and the downstream task on the ADNI dataset. Row 7 corresponds to STAMP. In the Pretraining column, (✗) indicates a method without the component. In the Downstream column, (✗) indicates a component added in the pretraining but not used in the downstream task. PRAUC baselines for 1 and 3 years are 0.07 and 0.18, respectively.
HARBOR
Model
6-months
12-months
AUROC ↑
PRAUC ↑
BACC ↑
AUROC ↑
PRAUC ↑
BACC ↑
STAMP embedding
0.700±0.047
0.140±0.042
0.615±0.049
0.671±0.057
0.200±0.066
0.607±0.042
STAMP token
0.694±0.035
0.139±0.033
0.620±0.030
0.674±0.045
0.198±0.051
0.607±0.037
ADNI
1-year
3-years
STAMP embedding
0.812±0.001
0.277±0.004
0.736±0.009
0.773±0.001
0.416±0.013
0.691±0.001
STAMP token
0.793±0.002
0.211±0.001
0.762±0.011
0.796±0.002
0.371±0.001
0.732±0.008
TABLE IV: Comparison of time encoding as an additive bias, i.e., the original STAMP design denoted as STAMP embedding , and as a separate input token, denoted as STAMP token . Results are reported over 4 folds on HARBOR and over repeated experiments on ADNI.
Model
AUROC ↑
PRAUC ↑
BACC ↑
0.8-0.2
0.788±0.003
0.258±0.002
0.723±0.013
25%
0.778±0.002
0.251±0.008
0.718±0.014
STAMP
0.812±0.001
0.277±0.004
0.736±0.009
TABLE V: Ablation studies for Masking ratio (75% and 25%) and symmetric KL term weighting (0.2–0.8 and 0.8–0.2 for posterior-prior respectively). The models are pretrained with the ADNI dataset.
Model
6-months
12-months
AUROC ↑
PRAUC ↑
BACC ↑
AUROC ↑
PRAUC ↑
BACC ↑
VisionFM [ 45 ]
0.631±0.036
0.090±0.010
0.583±0.075
0.593±0.053
0.126±0.017
0.553±0.058
ImageNet
0.665±0.029
0.096±0.026
0.614±0.033
0.640±0.022
0.151±0.052
0.578±0.013
RetFound [ 61 ]
0.636±0.043
0.091±0.027
0.560±0.024
0.551±0.024
0.121±0.042
0.531±0.033
TC [ 21 ]
0.643±0.033
0.101±0.011
0.611±0.050
0.599±0.067
0.143±0.042
0.564±0.057
MAE [ 27 ]
0.620±0.027
0.087±0.014
0.562±0.025
0.602±0.056
0.137±0.033
0.531±0.029
TABLE VI: Linear evaluation of wet-AMD conversion prediction on pretrained models within two time‐windows: 6 and 12 months on the HARBOR Dataset. ImageNet, VisionFM and RetFound are fully finetuned. The results are reported over 4-folds
Model
AUROC ↑
PRAUC ↑
BACC ↑
TC [ 21 ]
0.770 ±0.058
0.150±0.054
0.702±0.046
MAE [ 27 ]
0.830±0.025
0.208±0.042
0.752±0.046
SiamMAE [ 24 ]
0.833±0.036
0.229±0.053
0.755±0.040
CropMAE [ 22 ]
0.818±0.026
0.174±0.041
0.744±0.023
RSP [ 32 ]
0.769±0.031
0.155±0.036
0.690±0.039
STAMP
0.848±0.020
0.240±0.061
0.769±0.047
TABLE VII: Linear evaluation of GA conversion prediction within a 12 months time window on the PINNACLE Dataset. The models are pretrained with the HARBOR dataset. The results are reported over 5-folds
Model
AUROC ↑
PRAUC ↑
BACC ↑
10%
0.679±0.016
0.111±0.025
0.624±0.015
25%
0.691±0.044
0.140±0.025
0.617±0.015
50%
0.719±0.034
0.140±0.024
0.642±0.037
100%
0.700±0.047
0.140±0.042
0.615±0.049
TABLE VIII: Label-efficiency analysis for 6-month wet-AMD conversion prediction on HARBOR using different portions of the labeled downstream training data. The pretrained STAMP encoder is frozen and only the downstream classifier is trained. Results are reported over 4 folds.
Fig. 4: Left : PCA projection of 20 sampled tokens from the learned prior pψ per discrete Δt . Right : PCA projection of 20 sampled tokens from the learned prior pψ per fractional Δt . The temporal alignment indicates diverse but time sensitive stochastic sampling in both cases.
Fig. 5: Attention map visualization of STAMP w.r.t pretrained CLS. Each row is from a different volume. Left: Attention maps without using TE . Middle: Attention maps with 3 months prompted TE . Right: Attention maps with 15 months prompted TE .
Fig. 6: PCA of TE per discrete ( ∙ ) and fractional ( X ) Δt . The number indicates deviation of a fractional from the interpolated value between the discrete TE s.
Model
GFLOP
# of Params (M)
Runtime (min)
MAE [ 27 ]
45.1
104.8
1.9
SiamMAE [ 24 ]
153.6
109.6
10.9
CropMAE [ 22 ]
153.6
109.6
10.9
RSP [ 32 ]
281.9
116.1
19.1
STAMP
153.7
117.4
10.6
TABLE IX: Number of parameters, FLOP per iteration and runtime per epoch of pretraining
Model
1-year
3-years
AUROC ↑
PRAUC ↑
BACC ↑
AUROC ↑
PRAUC ↑
BACC ↑
Random init
0.690±0.006
0.142±0.002
0.628±0.010
0.713±0.030
0.317±0.039
0.652±0.015
ImageNet
0.736±0.007
0.188±0.013
0.639±0.008
0.712±0.041
0.301±0.056
0.670±0.024
yAware [ 18 ]
0.730±0.001
0.188±0.001
0.625±0.009
0.716±0.004
0.306±0.004
0.629±0.004
MAE [ 27 ]
0.721±0.002
0.152±0.002
0.634±0.012
0.712±0.002
0.285±0.004
0.674±0.011
SiamMAE [ 24 ]
0.775±0.004
0.220±0.001
0.721±0.006
0.787±0.001
0.362±0.003
0.726±0.002
TABLE X: Linear evaluation of AD conversion prediction on pretrained models within two time windows: 1 and 3 years on the ADNI Dataset. The results are reported over repeated experiments
Model
c-index ↑
TC [ 21 ]
0.664±0.023
MAE [ 27 ]
0.604±0.074
SiamMAE [ 24 ]
0.649±0.053
CropMAE [ 22 ]
0.603±0.061
RSP [ 32 ]
0.599±0.146
STAMP
0.747±0.071
TABLE XI: Linear evaluation of wet-AMD risk model. The models are pretrained with the HARBOR dataset. The results are reported in Concordance Index with bootstrapping
Department of Electrical Engineering, Indian Institute of Technology Madras (IITM), Chennai 600036, India · Sudha Gopalakrishnan Brain Centre (SGBC), IITM, Chennai 600036, India
Department of Artificial Intelligence Convergence, Chonnam National University, South Korea · Department of Nuclear Medicine, Chonnam National University, South Korea · University of South Australia, Australia +2