Abstract
Deep topological data analysis (TDA) offers a principled framework for capturing structural invariants such as connectivity and cycles that persist across scales, making it a natural fit for anomaly segmentation (AS). Unlike threshold-based binarisation, which produces brittle masks under test-time distribution shift (TTDS), TDA allows anomalies to be characterised as disruptions to global structure rather than local fluctuations. We introduce TopoOT, a topology-aware optimal transport (OT) framework for source-free test-time adaptation in AS. Our key innovation is Optimal Transport Chaining, which sequentially aligns persistence diagrams (PDs) across thresholds and filtrations, yielding geodesic stability scores that identify features consistently preserved across scales. These stability-aware pseudo-labels supervise a lightweight head updated online using only unlabelled target samples, without access to source data or target labels, with OT-consistency and contrastive objectives, ensuring robust adaptation under TTDS. Across standard 2D and 3D anomaly detection benchmarks, TopoOT achieves state-of-the-art performance, outperforming second-best methods by up to +24.1% mean F1 on 2D datasets and +10.2% on 3D AS benchmarks.
Topology-aware optimal transport chaining
TopoOT Test-time Adaptation for Anomaly Segmentation. The framework stabilises anomaly evidence through cross-PD optimal transport within each filtration, fuses sub- and super-level scores with cross-level transport, and back-projects stable components to supervise the test-time head.
Multi-scale filtration
Build sublevel and superlevel filtrations from the anomaly map and compute persistent topological structures.
Cross-PD alignment
Use entropy-regularised optimal transport to retain components that remain stable across filtration levels.
Cross-level fusion
Combine complementary sublevel and superlevel evidence into globally ranked structural candidates.
Source-free TTA
Back-project stable components into pseudo-labels and update only the lightweight segmentation head.
Quantitative comparison
Comparison of binary segmentation results across the evaluated 2D and 3D anomaly segmentation benchmarks. The figure is shown at full width for clearer readability.
Segmentation behaviour across 2D and 3D
Qualitative comparison using PatchCore on the 2D MVTec AD dataset. The full figure is displayed with its caption below.
Qualitative comparison on the MVTec 3D-AD dataset. The full figure is displayed with its caption below.
Citation
@inproceedings{zia2026topoot,
title={Topology-Aware Optimal Transport for Source-Free Test-Time Adaptation in Anomaly Segmentation},
author={Zia, Ali and Ali, Usman and Khamis, Abdelwahed and Ramzan, Muhammad Umer and Rehman, Abdul and Xiang, Wei},
booktitle={Advances in Neural Information Processing Systems},
year={2026}
}