Source-linked AI summary
Learning Pathology-Sensitive Representations for Unsupervised Retinal OCT Anomaly Detection
Tania Haghighi, Sina Gholami, Behafarin Emam, Jennifer I Lim, Theodore Leng, Atalie C Thompson, Hamed Tabkhi, Minhaj Nur Alam
TL;DR
OCT anomaly detection often relies on predefined disease categories or annotated abnormalities, leaving rare and unseen findings difficult to identify. This paper adapts pretrained visual representations to normal retinal anatomy through reconstruction and synthetic-perturbation triplet learning, finding that adaptation produces annotation-free detectors that outperform previous unsupervised methods for detection and localization.
Problem
Existing OCT approaches rely on predefined disease categories or annotated abnormalities, limiting recognition of rare or previously unseen findings.
Source: §1 · p. 2Method
The framework adapts pretrained encoders to normal retinal anatomy using anatomy-aware reconstruction and triplet learning guided by synthetic structural perturbations, without disease-specific annotations.
Source: §1 · p. 3, §4.3 · p. 13, §4.4 · p. 13Results
Adapting pretrained encoders to normal retinal anatomy with synthetic perturbations produced annotation-free detectors that outperformed previous unsupervised methods for detection and localization.
Source: §3 · p. 11Takeaways & Limitations
Adaptation to normal retinal structure, rather than the foundation model alone, is the key to building unsupervised OCT anomaly detectors.
Source: §3 · p. 11Localization was evaluated only against fluid annotations, so the assessment covers only a subset of abnormalities highlighted by the anomaly maps.
Source: §3 · p. 11
Abstract
from arXiv · showhide
Deep learning approaches for retinal optical coherence tomography (OCT) predominantly rely on predefined disease categories, limiting their ability to detect rare or previously unseen abnormalities. While visual foundation models provide transferable representations, their effectiveness in identifying pathological deviations from normal retinal anatomy remains insufficiently understood. In this work, we introduce an unsupervised framework for retinal OCT anomaly detection and localization that adapts pretrained visual representations to normal retinal anatomy through anatomy-aware reconstruction and contrastive triplet learning guided by synthetic structural perturbations, without requiring disease-specific annotations. We systematically investigate the influence of pretraining strategies, anatomy-aware representation adaptation, and anomaly scoring mechanisms on the detection and localization of unseen retinal abnormalities. Our findings demonstrate that adapting pretrained representations to normal retinal structure improves anomaly sensitivity, while pixel-space reconstruction errors and feature-space deviations provide complementary signals for identifying pathological changes. These findings underscore the importance of anatomy-aware representation learning and offer insights into developing generalizable retinal anomaly detection frameworks beyond predefined disease categories.
1 Introduction
Existing OCT deep-learning methods largely depend on predefined disease categories or annotated abnormalities, leaving rare and unseen findings difficult to recognize. This study introduces an unsupervised framework that adapts pretrained representations to normal retinal anatomy and examines how adaptation and anomaly scoring affect detection and localization.
- Existing approaches depend on predefined disease categories or annotated abnormalities, limiting recognition of rare, heterogeneous, or previously unseen findings.The challenge is acute when pathological changes subtly disrupt retinal anatomy, coexist with other abnormalities, or differ from observed disease patterns.Source: §1 · p. 2
- The framework combines pretrained visual representations, anatomy-aware reconstruction, and triplet learning guided by synthetic structural perturbations to detect and localize abnormalities without disease-specific annotations.The study also investigates pretraining strategies, representation adaptation, and pixel-space versus feature-space anomaly signals.Source: §1 · p. 3
- The study systematically examines how pretraining strategies and anatomy-aware adaptation affect sensitivity to unseen retinal abnormalities, including the roles of reconstruction, ROI weighting, perturbation diversity, and normal-data availability.Source: §1 · p. 3
- Pixel-space reconstruction errors and feature-space deviations are investigated as complementary signals for detection, localization, and cross-device generalization without additional training or pathological annotations.Source: §1 · p. 3
2 Results
The study trains pretrained encoders on normal OCT anatomy using reconstruction and synthetic-perturbation triplet objectives, then evaluates image-level detection and pixel-level localization. Ablations examine data availability, training objectives, scoring strategies, and perturbation types; the supplied results report that performance varies with the amount of normal training data and encoder.
2.1 Study overview; 2.2 Datasets
- Models were trained on normal Kermany B-scans and evaluated for image-level detection on its held-out test set and pixel-level localization on RETOUCH without further training.RETOUCH includes expert annotations and images from devices not seen during training.Source: §2.1 · p. 4, §2.2 · p. 5
2.3 Anomaly detection
- Image-level detection on the Kermany test set was evaluated using AUROC, F1 score, and accuracy across the complete models and unsupervised comparison methods.Source: §2.3 · p. 5, Table 1 · p. 5
2.4 Anomaly localization
- Localization on RETOUCH compared anomaly maps with expert IRF, SRF, and PED annotations using Dice and foreground-only mIoU.The models were applied without further training.Source: §2.4 · p. 6, Table 2 · p. 6
2.5.1 Training objective
- The training-objective ablation compared frozen encoders, joint reconstruction training, added triplet learning, and a complete model with retinal ROI weighting.The table caption identifies reconstruction-only values as illustrative placeholders, not measured results.Source: §2.5.1 · p. 6, Table 3 · p. 7
2.5.2 Amount of training data
- With the full training set, ImageNet-pretrained ViT achieved AUROC 0.921 and Dice score 0.242, while RETFound achieved AUROC 0.766 and Dice score 0.141 with only 0.5% of training data.DINOv3 remained the weakest performer across all training fractions.Source: §2.5.2 · p. 6
2.5.3 Feature-level scoring
- For feature-level scoring, patch features were compared with a bank from normal training images, whereas pixel-level scoring used image-to-reconstruction residuals; both used thresholds calibrated on normal validation images.Source: §2.5.3 · p. 7
2.5.4 Perturbation strategy
- The perturbation ablation trained separate models with individual synthetic perturbation types and a model combining all six, then assessed detection on Kermany and localization on RETOUCH.The overview describes the triplet-learning negative as a synthetically perturbed version of a normal anchor.Source: §2.1 · p. 4, §2.5.4 · p. 7
3 Discussion
Adapting pretrained encoders to normal retinal anatomy with synthetic structural perturbations was the main determinant of performance and outperformed previous unsupervised methods for detection and localization. Results also varied with pretraining, data availability, scoring strategy, and localization weighting, while the evaluation and model scope leave clear limitations.
3 Discussion
- Frozen encoders missed most abnormal B-scans, whereas triplet adaptation produced the largest detection improvement across all three encoders.Reconstruction focuses the representation on normal retinal anatomy, while triplet learning distinguishes structural departures from it.Source: §3 · pp. 8–9
- With full training data and reconstruction-based scoring, ImageNet ViT performed best, followed by RETFound and DINOv3.The authors suggest RETFound may already encode diseased structures, reducing residual contrast, while DINOv3's dense features may be difficult for a linear head to decode into pixels.Source: §3 · pp. 9–10
- ROI weighting improved localization for all encoders, but its detection effect varied: it raised recall and F1 for ImageNet ViT and RETFound and reduced DINOv3 performance.The authors attribute the localization benefit to concentrating reconstruction on retinal tissue rather than background noise.Source: §3 · p. 10
- Adapted RETFound and ImageNet ViT outperformed previous unsupervised methods, including anatomy-aware VQGAN, for detection and localization on RETOUCH without training on its images.RETOUCH differed from training data in device, resolution, and noise.Source: §3 · pp. 7, 10, 11
- With the smallest training set, RETFound performed best for detection and localization, but ImageNet ViT overtook it with a small fraction of the data as training data increased.DINOv3 remained the weakest encoder at every data size.Source: §3 · pp. 10–11
- Feature-level scoring improved localization for all three encoders and detection AUROC for DINOv3 and RETFound, with RETFound achieving the study's best localization.The findings suggest that reconstruction can hide abnormality information retained in patch features.Source: §3 · p. 11
- The study evaluated localization only against fluid annotations, compared three encoders of one architecture and size, and used a linear reconstruction head that limits absolute performance.The framework also operates on individual 2D B-scans; volume-level and prospective clinical evaluation remain future work.Source: §3 · p. 11
4 Methods
The methods standardize OCT preprocessing, compare three pretrained encoders under a shared architecture, and adapt them through normal-image reconstruction with progressively stronger training configurations.
4.1 Image preprocessing
- Images were resized to 256×256 pixels and normalized with ImageNet channel statistics, without data augmentation.Source: §4.1 · p. 11
4.2 Pretrained encoders
- Three ViT-L/16 encoders separate pretraining domain and strategy: self-supervised DINOv3 and RETFound, and supervised ImageNet pretraining.All produce 256 patch tokens of 1024 dimensions for reconstruction; the class token supplies the triplet objective’s image-level embedding.Source: §4.2 · p. 12
4.3 Reconstruction framework
- A linear reconstruction head maps patch tokens to pixels, with no spatial context, so reconstruction quality depends mainly on the encoder.The study compares frozen encoders, joint encoder-and-head training, and a complete configuration that adds retinal ROI-weighted reconstruction.Source: §4.3 · pp. 12–13
4.4 Training objectives
Training combines anatomy-aware reconstruction with a triplet objective that uses synthetic structural changes to adapt pretrained encoders on normal OCT images, without real pathology.
4.4 Training objectives
- The reconstruction loss combines pixel intensity, structural similarity, and perceptual feature terms, with retinal pixels weighted more heavily in the complete model.The perceptual loss compares patch tokens using a frozen copy of each model’s own pretrained encoder.Source: §4.4 · p. 13
- Triplet learning pulls embeddings of normal images together and pushes a synthetically perturbed anchor away from its normal source.The anchor and a different normal positive are reconstructed to themselves, while the negative is reconstructed toward the clean anchor.Source: §4.4 · p. 13
- The same triplet adaptation step is applied to every encoder, enabling comparison of how their representations respond to the same signal.The full training objective combines reconstruction and triplet losses.Source: §4.4 · pp. 13–14
- Synthetic negatives use structural deformation and localized intensity changes within the retina, rather than imitating specific diseases.Each anchor is paired with one negative from each perturbation family.Source: §4.4 · pp. 13–14
4.5 Image-level anomaly scoring
Image-level anomaly scoring uses reconstruction residuals, emphasizing a small high-error region and setting its abnormality threshold from normal validation images.
4.5 Image-level anomaly scoring
- The anomaly score is the mean of the 5% largest absolute residuals, reducing dilution of signals from small lesions.Source: §4.5 · p. 14
- The decision threshold is the 95th percentile of scores on normal validation images, corresponding to about a 5% false-positive rate on normal images.Source: §4.5 · p. 14
- A test image is classified as abnormal when its anomaly score exceeds the normal-validation threshold.Source: §4.5 · p. 14
4.6 Anomaly localization
Localization uses residual maps to identify pathological regions, with thresholds derived from Kermany normal images and evaluation on RETOUCH devices not used for training.
4.6 Anomaly localization
- Localization identifies the pathological region responsible for the anomaly signal, rather than segmenting retinal layers.Source: §4.6 · p. 14
- Residual maps are thresholded at the 99th percentile of pixel residuals in Kermany normal validation images, then compared with combined IRF, SRF, and PED annotations using Dice and mIoU.Source: §4.6 · pp. 14–15
- Models trained on Kermany are applied to RETOUCH without further training or recalibration, testing localization across three devices with differing resolution, noise, and intensity.Source: §4.6 · pp. 14–15
4.7 Feature-level anomaly scoring
The framework scores abnormality both in reconstructed pixels and directly in feature space. The feature-level score measures how far test patches are from normal representations.
- Reconstruction-based scoring measures pixel-space error after a simple linear head, while feature-space scoring directly measures deviations in the encoder representation.The simple head may omit abnormal-structure information captured by the encoder.Source: §4.7 · p. 15
- Feature-level scoring compares each test patch with a bank of normal training features and assigns its distance to the nearest normal feature as the anomaly score.Image-level scores aggregate the highest patch scores; patch-level scores are arranged on a 16 × 16 grid and resized for localization.Source: §4.7 · p. 15
- The feature bank and thresholds use only normal data, without pathological images or annotations.The threshold is calibrated on normal validation images, as for reconstruction-based scoring.Source: §4.7 · p. 15
4.8 Ablation studies
Four ablations examine training objectives, normal-data availability, scoring strategy, and synthetic perturbations. The designs compare these factors while holding other settings fixed where specified.
- Training-component ablations compare a frozen pretrained encoder, joint encoder-and-head optimization with reconstruction and triplet losses, and ROI-weighted reconstruction.The configurations assess pretrained-feature reconstruction, adaptation to normal anatomy while distinguishing synthetic abnormalities, and emphasis on retinal structures.Source: §4.8 · p. 15
- Data-efficiency models use 0.5%, 1%, 2%, or 5% of normal training data or the full dataset, with ten random subsets per fraction.All other training settings remain fixed.Source: §4.8 · p. 15
- Scoring ablations apply reconstruction-based pixel differences and feature-bank deviations to the same trained models, isolating the scoring strategy from model training.The comparison addresses whether encoder-captured structural changes appear in reconstructions made with a simple linear decoder.Source: §4.8 · pp. 15–16
- Perturbation ablations compare a combined six-perturbation model with six models trained on one pathology-inspired perturbation each, retaining normal augmentations.The perturbations represent layer thinning or thickening, drusen, PED, subretinal fluid, and foci; models are selected on held-out normal data and evaluated on Kermany and RETOUCH.Source: §4.8 · p. 16
4.9 Comparison methods
Pretrained encoders were compared with six unsupervised anomaly-detection methods under identical data partitions and evaluation protocols.
- The comparison includes a ConvNeXt reconstruction model, VAE, VQ-VAE, VQGAN, f-AnoGAN, and anatomy-aware VQGAN combining vector quantization with triplet objective and ROI weighting.All methods were trained and evaluated using identical data partitions and protocols.Source: §4.9 · p. 16
4.10 Evaluation metrics
Evaluation uses image-level detection metrics on Kermany and pixel-level localization metrics on RETOUCH. The methods also specify implementation details and statistical procedures.
4.10 Evaluation metrics
- Image-level detection uses AUROC, accuracy, F1, precision, and recall; localization uses Dice and mIoU.AUROC summarizes performance across thresholds.Source: §4.10 · p. 16
4.11 Implementation
- All models were implemented in PyTorch and trained on a single GPU with 48 GB of memory.Detailed configurations, hyperparameters, and loss weights are provided in Supplementary Section S1.Source: §4.11 · p. 16
4.12 Statistical analysis
- Models use identical held-out test sets, with thresholds calibrated only on normal Kermany validation images.The image-level threshold is the 95th percentile of normal validation scores, and the reconstruction localization threshold is the 99th percentile of pixel-level reconstruction errors.Source: §4.12 · p. 16
- Uncertainty is estimated from 100 bootstrap resamples with 95% confidence intervals, and model differences use paired bootstrap comparisons.Data-efficiency results are means across ten independently sampled subsets per training fraction.Source: §4.12 · p. 17
Supplementary Information
The supplementary methods specify the shared model and training setup, automatic retinal-region weighting, synthetic perturbations, and feature-bank anomaly scoring.
S1. Model configuration and training 2
- DINOv3, RETFound, and supervised ImageNet ViT-L/16 used the same ViT-L/16 encoder, linear patch decoder, and training protocol.The setup used 256 × 256 inputs, 16 × 16 patches, AdamW, batch size 16, and 100 epochs; model selection used normal-only validation loss.Source: S1. Model configuration and training · p. 22
S2. Retinal region-of-interest estimation 9
- A retinal mask from clean B-scans weights retinal pixels more heavily in reconstruction, with ROI detection based on horizontal Gabor responses and image processing.The procedure removes bright borders, enhances horizontal structures, binarizes responses, applies morphological opening and closing, then selects a wide connected component; α controls ROI weighting.Source: S2. Retinal region-of-interest… · pp. 22–23
S3. Synthetic perturbation generation 19
- Synthetic negatives introduce localized retinal structural changes into normal B-scans, providing abnormality signals without diseased training images.Perturbations are ROI-guided and vary in size, number, and location; the ablation spans six complementary anatomical-change families, including specified thinning, thickening, drusen, and hyperreflective-foci ranges.Source: S3. Synthetic perturbation generation · p. 23
S4. Normal feature bank and feature-level scoring 30
- A separate normal feature bank for each encoder scores test patches by nearest-reference distance, then forms dense maps and image-level scores from the most anomalous patches.The bank stores final-layer spatial patch embeddings from normal Kermany training images; higher distances indicate stronger deviations from normal-training representations.Source: S4. Normal feature bank and… · p. 23