Imaging & devices · Research feature

Pretraining Strategy Affects Retinal Image Analysis in Foundation Models

A study compares how different pretraining methods in vision models influence disease classification in ultra-widefield retinal images.

Adapted from research by Mingya Alexa Gong, Da Ma, Lovre Antonio Budimir and colleagues.

arXiv preprint revision · 2026-08-01 · Attribution & reuse
In this article
Editorial illustration of scanner.

Editor’s introduction

The research evaluates Vision Transformer encoders pretrained with supervised, Masked Autoencoder, and self-distillation objectives for disease classification in ultra-widefield retinal imaging using a patch-based multiple instance learning framework. It finds that supervised and self-distillation models outperform MAE-based models in transferability, with DINOv3 achieving strong performance on five-class diabetic retinopathy grading. Attention analysis shows distinct patch aggregation behaviors across pretraining strategies, indicating differences in how features are combined. The study notes that partial fine-tuning reduces the performance gap for MAE models, suggesting adaptation improves transferability. The framework was tested on three datasets: MMRDR as primary, and DeepDRiD and intraocular tumour datasets for external and cross-disease validation. A key limitation is that attention maps show strong focus on structures like the optic nerve head, which may reflect non-causal patterns in the data, such as artefacts or acquisition biases, rather than direct disease signals. This highlights potential limitations in weakly supervised methods relying on consistent but not necessarily causal image features.

Introduction

In this work, we investigate how different pretrained visual representations transfer to high-resolution UWF retinal image analysis within a controlled patch-based MIL framework. We compare generalist Vision Transformer (ViT) encoders pretrained with supervised learning, Masked Autoencoder (MAE), and self-distillation-based objectives on multiple UWF retinal classification datasets. In addition to standard classification metrics, we investigate the effect of patch-based image representation, analyse MIL attention distributions to characterise patch aggregation behaviour, and examine the impact of limited encoder adaptation through partial fine-tuning.

Foundation Models in Ophthalmic Imaging

However, most existing work focuses on developing specialised foundation models and improving downstream tasks, with less attention paid to understanding how different pretraining strategies and pretext tasks influence downstream performance when transferring general-purpose representations to ophthalmic imaging tasks. Understanding this relationship is particularly important when foundation models are deployed as frozen feature extractors, where downstream performance depends heavily on the transferability of the learned representations.

Patch sampling during MIL inference and MIL training

Bag-level classification was performed using an attention-based MIL pooling module that aggregates instance features, localises the most informative tiles and pools them together for the full image representation. This attention module was made up of a linear layer, tanh activation, and a linear attention layer, and learns to assign weights to each patch representation and identify the most informative regions for prediction. The aggregated feature representation was passed through layer normalisation to stabilise feature scaling, and a linear classifier for final image-level prediction. Instance dropout was set to 0.3 to improve generalisation.

The feature encoder was frozen during MIL training so that the model evaluated the quality of the pretrained representations without further updating the encoder parameters. Only the attention-based MIL module and the final classifier layer were trained.

High-Resolution Image Representation

For all four strategies, the same encoder weights, learning rate, downstream classifier, optimiser, and training protocol were used. To enable a fair comparison against the Global baseline and to keep this preliminary comparison computationally efficient, instance dropout was disabled and models were trained with a reduced early-stopping patience (patience = 5). Consequently, results in this section are not directly comparable to the main encoder comparison in Section IV.A.2, which used the full training protocol described in Section III.B.2.

Pretrained Feature Extractors within the MIL framework

Accordingly, the controlled comparison of pretraining objectives was based primarily on the supervised, MAE, and DINOv1 ViT-B encoders pretrained on ImageNet. DINOv3 was additionally evaluated as a contemporary large-scale self-distillation model, while the domain-specific MAE was included as a complementary comparison and was not used to isolate the effect of pretraining objective.

Representation Analysis

In addition, we visualised bag-level feature representations using Uniform Manifold Approximation and Projection (UMAP). For each image, the aggregated bag representation produced by the MIL module prior to the final classification layer was extracted and projected into a two-dimensional space to enable qualitative comparison of feature space organisation across the different pretraining strategies.

Downstream Evaluation Metrics

The proposed framework was evaluated on three downstream classification datasets, each serving a complementary role within the experimental design. The MMRDR dataset was used as the primary analysis dataset, while the DeepDRiD and intraocular tumour datasets were used to assess external and cross-disease evaluation, respectively.

Representation Strategy

We compared four representation strategies using the same frozen encoder (DINOv3). Under this experimental setting, representing UWF images using multiple higher-resolution local patches generally improved performance relative to representing the complete image using a single low-resolution embedding, as shown in Table I. Dividing the full image into patches and averaging patch-level representations increased the QWK (from 0.7999 to 0.8358) and AUROC (from 0.8423 to 0.8799), demonstrating that preserving local retinal information can provide more discriminative image representations than compressing the entire retina into a single global embedding. Max pooling produced the weakest performance (QWK = 0.7895), suggesting that disease severity cannot be reliably characterised by the most salient retinal region alone. In contrast, the proposed attention-based MIL framework achieved the highest performance (QWK = 0.8621), suggesting that adaptive aggregation of multiple retinal regions provides the most informative image representation for DR grading. Results are based on a single run, with a reduced protocol.

Multiple-Instance Learning Framework

Across the three datasets, supervised and self-distillation-based Vision Transformers generally achieved the strongest performance, although the relative ranking of the reconstruction-based models varied across tasks. Within the controlled ImageNet-pretrained ViT-B comparison, supervised and self-distillation-based pretraining outperformed reconstruction-based MAE on the primary MMRDR benchmark, indicating superior transferability of frozen representations within the proposed MIL framework. DINOv3 achieved the highest mean QWK (0.8629 ± 0.0102), marginally above DINOv1 (0.8602 ± 0.0034); this difference lies within one standard deviation and the two self-distillation encoders should be regarded as performing comparably on this benchmark.

In contrast, the ranking shifted on the smaller binary DeepDRiD task. DINOv3 remained the strongest model (AUROC = 0.9030), but ViT-MAE(ImageNet) achieved an AUROC of 0.8131, comparable to DINOv1 (0.8136), suggesting that the relative advantage of discriminative pretraining was less pronounced for binary DR classification than for five-class grading. The larger standard deviations for several models on DeepDRiD also reflect greater variation across runs on this small dataset.

On DeepDRiD, ViT-MAE(AlzEye)+MIL did not perform above chance (AUROC = 0.5207 ± 0.0353). On the five-class MMRDR task the same encoder performed above chance (QWK = 0.3247 ± 0.0474), but substantially below all general-purpose encoders. The comparatively weak performance of ViT-MAE(AlzEye) on both DR datasets suggests that the learned retinal-domain representations transferred less effectively to DR classification than the large-scale general-purpose discriminative encoders when used as frozen feature extractors within the MIL framework. In contrast, its comparatively stronger performance on intraocular tumour classification indicates that these representations retained information useful for distinguishing more pronounced abnormalities. However, this observation should be interpreted cautiously because the domain-specific model differs from the general-purpose encoders in architecture, model capacity, pretraining scale, and training configuration.

Visualisations of Model Attention

To qualitatively assess how different feature extractors utilise retinal information for downstream tasks, we visualised the distribution of attention to image patches for representative examples. These visualisations were generated by projecting the MIL attention weights onto the corresponding patch locations and overlaying them on the reconstructed patch mosaic. Attention weights were min-max normalised and heatmaps were generated with the same scale. We observed notable differences between models.

MMRDR Attention Analysis

In contrast, the supervised ViT and ViT-DINOv1 encoders produced more structured attention maps, assigning greater importance to central retinal regions. The supervised ViT typically concentrated attention on the optic nerve head. ViT-DINOv1 exhibited a more graded attention distribution, characterised by one or two dominant patches surrounded by neighbouring patches with progressively lower attention weights. In comparison, the ViT-DINOv3 encoder assigned relatively high attention across a broader region of the posterior retina rather than concentrating on single dominant patches. Attention remained focused on the retinal area while largely avoiding the peripheral image borders and non-retinal background.

Cross-disease Analysis

Notably, certain feature extractors appeared to cause the MIL module to adopt different strategies to identify relevant features. For the supervised feature extractors, attention was focused on fewer, highly weighted patches. For the self-supervised feature extractors, attention was distributed across a broader area.

Further Adaptation of Encoders

To investigate whether weaker frozen representations could benefit from limited task-specific adaptation, we repeated the MMRDR experiments with only the final encoder block of each Vision Transformer unfrozen. Table III compares the QWK scores obtained using frozen and partially fine-tuned encoders across three runs.

Partial fine-tuning improved performance for all evaluated Vision Transformer models, although the magnitude of improvement differed substantially between pretraining strategies. The largest improvements were observed for the MAE-based encoders (+0.2875 QWK for ViT-MAE(ImageNet) and +0.2192 QWK for ViT-MAE(AlzEye)), whereas the supervised ViT and DINO-based models exhibited comparatively smaller gains. This finding suggests that the frozen discriminative representations learned through supervised and self-distillation objectives transfer more effectively to the proposed patch-based MIL framework, while reconstruction-based representations benefit more substantially from downstream adaptation.

Despite the substantial performance improvement observed for the MAE-based encoders, no obvious qualitative changes were observed in the learned attention distributions across representative test images. The primary difference was an increase in prediction confidence rather than a change in the spatial weighting of retinal regions. These observations suggest that partial fine-tuning primarily improved the encoded patch representations rather than altering how the MIL module aggregated spatial information.

Discussion

In this study, we investigated how foundation model representations transfer to high-resolution UWF retinal image analysis within a controlled patch-based MIL framework. By combining patch-level feature extraction with attention-based aggregation, the proposed framework enabled different pretrained representations to be compared while preserving the spatial information present in UWF images. Beyond comparing pretraining strategies, the framework also allowed us to investigate how high-resolution image representation and limited encoder adaptation influence downstream performance.

UWF retinal images frequently contain pathological biomarkers distributed across multiple retinal regions. Unlike conventional image classification, which compresses the entire retina into a single representation following aggressive image downsampling, the proposed patch-based framework preserves local retinal detail throughout feature extraction. The improved performance of patch-based representations with mean or attention pooling suggests that preserving these local features benefits DR grading, although requiring more encoder evaluations than the global baseline. Interestingly, selecting only the strongest patch response through max pooling resulted in the lowest performance, suggesting that DR severity is not determined by a single dominant feature, but rather by the cumulative distribution of pathological features across the retina. Attention-based MIL further improved performance by learning to adaptively weight information from the multiple retinal regions. This is consistent with clinical assessment of DR images, where disease grading is based on the combined distribution and severity of lesions, including haemorrhages, microaneurysms, venous abnormalities, and neovascularisation. This may be particularly relevant for UWF imaging, where clinically important lesions might extend into the retinal periphery and compressing the entire field of view inevitably reduces the spatial resolution available to identify these peripheral abnormalities.

Attention analysis provided insight into the differing behaviour of the pretrained representations interacting with the MIL module. For example, when analysing a healthy image, the supervised ViT-based model tended to concentrate attention on a smaller number of patches, primarily around the optic nerve head, whereas the DINO-based model distributed attention over a larger region of the retina. Quantitative analysis also supported the difference in attention distribution, with the DINOv3-based model demonstrating structured attention while avoiding peripheral image borders and non-retinal background. Interestingly, attention was not assigned to all visible pathological features. Instead, the models consistently prioritised a subset of retinal regions while assigning relatively low attention to other abnormalities. This behaviour is expected within an MIL framework, where the attention mechanism learns which patch representations are most informative for image-level classification rather than performing exhaustive lesion localisation.

In contrast, the ViT-MAE(ImageNet) encoder exhibited different attention behaviour across the downstream tasks. For the five-class DR grading and intraocular tumour datasets, attention remained uniform, indicating little distinction between retinal regions. These findings suggest that the frozen MAE representations did not provide sufficiently discriminative local features for the MIL module to reliably identify potentially informative retinal regions. Consequently, although these representations remained adequate for the simpler binary classification tasks, they struggled to distinguish the more subtle local differences required for multi-class DR grading.

After unfreezing the final encoder block, both ViT-MAE(AlzEye) and ViT-MAE(ImageNet) demonstrated substantial improvements in downstream performance (+0.2192 and +0.2875 QWK, respectively; see Table III), supporting the view that MAE representations benefit substantially from downstream adaptation. Notably, after partial fine-tuning the MAE(ImageNet) encoder reached QWK = 0.8200 ± 0.0144, comparable to the frozen supervised ViT (QWK = 0.8396 ± 0.0043). These findings suggest that the observed disadvantage of MAE is largely confined to the frozen transfer setting investigated in this study. Consequently, reconstruction-based encoders may remain competitive when downstream adaptation is feasible, whereas the choice of pretraining objective appears most influential when pretrained representations are used as fixed feature extractors.

Limitations

This study has several limitations. First, qualitative analysis of the attention maps suggested that certain anatomical structures, particularly the optic nerve head, frequently received high attention weights. While this may reflect clinically relevant contextual information, it also highlights a broader limitation of weakly supervised approaches, including MIL, where models may exploit consistent but non-causal patterns in the data. Other examples include motion or peripheral artefacts being more prevalent in pathological cases due to patient discomfort, or device and operator-specific acquisition biases. Such patterns may be inadvertently associated with disease labels and subsequently exploited by the MIL framework. Further investigation is therefore required to disentangle true pathological signals from acquisition-related biases, for example through controlled datasets, experiments designed to isolate acquisition conditions, and bias mitigation strategies based on standardised preprocessing.

The potential benefits of patch-based learning may be underestimated in this study. The UWF images used for training and evaluation were resized to 1024 × 1024 pixels for computational feasibility, rather than using the native Optomap resolution of approximately 4000 × 4000 pixels. While this resolution preserves substantially more spatial information than conventional image classification pipelines, it does not fully capture the potential advantages of patch-based learning on true full-resolution UWF images.

Evaluation was limited by the small number of publicly available labelled UWF retinal datasets. Compared with conventional CFP, labelled UWF datasets remain relatively scarce, and the available datasets are typically small, class-imbalanced, and have limited evaluation protocols. Although the datasets used in this study span both DR grading and intraocular tumour classification, it remains unclear whether the observed differences between pretraining strategies generalise to other UWF cohorts, imaging technologies, grading protocols, or retinal diseases. Furthermore, patient identifiers were unavailable for the intraocular tumour dataset, preventing verification of subject-level separation between training and evaluation partitions. Consequently, the possibility of the same eye appearing across training and evaluation folds cannot be excluded, and the performance on this dataset should be interpreted with appropriate caution.

A common preprocessing pipeline was applied across all encoders rather than checkpoint-specific normalisation. Although this ensured a consistent downstream evaluation, frozen pretrained models may differ in their sensitivity to input statistics, and future work should investigate whether the observed trends remain consistent when each pretrained model is evaluated using its native preprocessing pipeline.

Finally, interpretation of the domain-specific MAE results should be made with caution. The comparison with generalist foundation models is not strictly controlled, as the domain-specific model differs not only in pretraining data but also in architecture and pretraining scale. Consequently, the observed performance differences cannot be attributed solely to domain-specific pretraining. Nevertheless, the domain-specific MAE model achieved reasonable performance on the binary tumour classification task and demonstrated more structured attention patterns than the ImageNet-pretrained MAE encoder, suggesting that retinal-domain pretraining may influence the spatial organisation of patch representations. Future work should investigate larger-scale domain-specific foundation models with comparable architectures to enable a fairer evaluation of domain-specific versus generalist pretraining.

Conclusion

In this study, we investigated how different foundation model representations transfer to high-resolution UWF retinal image analysis within a controlled patch-based MIL framework. By preserving local retinal information through patch-based feature extraction and attention-based aggregation, the proposed framework enabled a systematic comparison of supervised and self-supervised Vision Transformer representations while avoiding the computational challenges associated with processing full-resolution UWF images.

Our results suggest that preserving high-resolution spatial information is beneficial for UWF retinal image analysis, with a supporting representation-strategy analysis favouring patch-based attention pooling over a single low-resolution global representation. Furthermore, the choice of pretraining objective substantially influenced downstream performance. Across the evaluated tasks, discriminative pretraining approaches, including supervised learning and self-distillation, produced more transferable feature representations than reconstruction-based Masked Autoencoder pretraining when used as frozen feature extractors. Attention analysis further showed that these representations resulted in distinct aggregation behaviours within the MIL framework, while partial fine-tuning substantially improved the performance of MAE-based models, highlighting the importance of downstream adaptation for reconstruction-based representations.

Overall, these findings demonstrate that the effectiveness of high-resolution UWF retinal image analysis depends not only on preserving spatial information, but also on the transferability of the underlying pretrained representations. The proposed framework provides a controlled approach for evaluating foundation model representations and offers practical insight into the selection of pretrained encoders for high-resolution retinal image analysis.