Test-Time Adaptation for Anomaly Segmentation via Topology-Aware Optimal Transport Chaining
Ali Zia, Usman Ali, Umer Ramzan, Abdul Rehman, Abdelwahed Khamis, Wei Xiang
TL;DR
TopoOT addresses anomaly segmentation under distribution shift by replacing brittle, threshold-based masks with topology-guided pseudo-labels derived from multi-scale persistence diagrams, then supervising a lightweight test-time training head via OT-consistency and contrastive objectives. It introduces Optimal Transport Chaining to align persistence diagrams across sublevel and superlevel filtrations and across scales, yielding stable, interpretable anomaly cues that are back-projected to pixel space. The approach achieves state-of-the-art results across 2D and 3D anomaly localization benchmarks, demonstrating strong generalization and cross-model transfer with a modest per-sample runtime. By grounding adaptation in topological structure and efficient OT, TopoOT offers practical robustness for industrial anomaly segmentation under real-world distribution shifts.
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 thresholdbased binarisation, which produces brittle masks under distribution shift, 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 that integrates multi-filtration persistence diagrams (PDs) with test-time adaptation (TTA). Our key innovation is Optimal Transport Chaining, which sequentially aligns PDs across thresholds and filtrations, yielding geodesic stability scores that identify features consistently preserved across scales. These stabilityaware pseudo-labels supervise a lightweight head trained online with OT-consistency and contrastive objectives, ensuring robust adaptation under domain shift. Across standard 2D and 3D anomaly detection benchmarks, TopoOT achieves state-of-the-art performance, outperforming the most competitive methods by up to +24.1% mean F1 on 2D datasets and +10.2% on 3D AS benchmarks.
