TopoTTA: Topology-Enhanced Test-Time Adaptation
- The paper presents a novel two-stage framework using TopoMDCs and TopoHG to adapt CNNs for topology-sensitive segmentation under domain shifts.
- It introduces patch-specific routing weights to preserve pretrained features while addressing topological discrepancies and maintaining continuous tubular structures.
- Experimental results demonstrate significant improvements in clDice and Dice metrics across multiple tubular segmentation benchmarks, validating the framework’s efficiency.
Searching arXiv for the specified TopoTTA and related topology-aware test-time adaptation papers. arXiv search query: all:"TopoTTA" OR ti:"Topology-enhanced Test-Time Adaptation" OR ti:"Test-Time Adaptation for Anomaly Segmentation via Topology-Aware Optimal Transport Chaining" OR ti:"Learning Topology-Aware Representations via Test-Time Adaptation for Anomaly Segmentation" Topology-enhanced Test-Time Adaptation (TopoTTA) is a test-time adaptation framework that incorporates topological priors into deployment-time model updating under domain shift. In its original and most specific usage, TopoTTA denotes a two-stage framework for tubular structure segmentation (TSS), where domain adaptation must preserve connectivity and continuity in thin, elongated foregrounds such as retinal vessels, roads, neuronal processes, and OCTA vessels (Zhou et al., 1 Aug 2025). Related later work extended the broader idea of topology-aware TTA to anomaly segmentation, but the canonical TopoTTA formulation is the TSS method built from Topological Meta Difference Convolutions (TopoMDCs) and Topology Hard sample Generation (TopoHG) (Zhou et al., 1 Aug 2025).
1. Scope, motivation, and problem setting
Tubular structure segmentation is unusually sensitive to domain shift because errors affect both appearance and topology. The original TopoTTA formulation distinguishes appearance shifts—including changes in contrast, noise, texture, imaging device, and acquisition style—from topological shifts, including changes in trajectory, curvature, branching patterns, and thickness (Zhou et al., 1 Aug 2025). In TSS, a small number of incorrect pixels can interrupt a centerline, create gaps, destroy skeleton connectivity, or inflate topology errors. Consequently, overlap-oriented adaptation alone is inadequate.
The source-to-target TTA setting used by TopoTTA is standard. A labeled source dataset is written as
and a model is first trained by
The target dataset is unlabeled,
and online per-image adaptation follows
with (Zhou et al., 1 Aug 2025).
Within this setting, TopoTTA is described as the first test-time adaptation framework designed specifically for TSS. The central premise is that TTA for tubular structures must address both topological discrepancy across domains and fragile continuity inside predicted structures. This suggests a division of labor between a structural adaptation stage and a continuity-restoration stage, which is exactly how the framework is organized.
2. Two-stage architecture
TopoTTA consists of two stages (Zhou et al., 1 Aug 2025). Stage 1, Topological Structure Adaptation, uses Topological Meta Difference Convolutions to adapt representations to domain-specific topological patterns while updating only a small set of router parameters. Stage 2, Topological Continuity Refinement, uses Topology Hard sample Generation to synthesize local pseudo-breaks and trains the model to recover continuity by prediction alignment on these hard samples.
| Stage | Main mechanism | Function |
|---|---|---|
| Stage 1 | TopoMDCs | Adapt to cross-domain topological discrepancies |
| Stage 2 | TopoHG + prediction alignment | Improve topological continuity on hard samples |
This decomposition is technically important. Stage 1 targets structural changes in tubular geometry, while Stage 2 targets local foreground-background discrimination around critical regions where continuity is easily broken. A common misconception is that topology-aware TTA necessarily means direct topological loss optimization over the whole model. In TopoTTA, the adaptation is more constrained: pretrained convolution weights are preserved in Stage 1, and the second stage uses teacher-student consistency on synthesized pseudo-break regions rather than whole-network retraining (Zhou et al., 1 Aug 2025).
The framework is designed as a plug-and-play TTA solution for CNN-based TSS models. It is evaluated with U-Net and CS2Net, and a variant is also reported on DSCNet. TopoMDCs replace all convolution layers in the encoder, while Stage 2 adds the teacher-student refinement branch (Zhou et al., 1 Aug 2025).
3. Stage 1: Topological Meta Difference Convolutions
TopoMDCs are motivated by the limitations of Central Difference Convolution (CDC). CDC emphasizes local differences between a center pixel and its neighbors, but the TopoTTA paper argues that TSS requires explicit modeling of directional elongation, continuity along curves, and local tubular topology such as branches, bends, and thin junctions (Zhou et al., 1 Aug 2025).
For a neighborhood,
the vanilla convolution is
CDC is described in center-difference form as
0
TopoMDCs then define eight directional operators,
1
to encode eight directional topological patterns (Zhou et al., 1 Aug 2025).
For example, the top-left directional operator is
2
with
3
The appendix provides analogous definitions for the other seven directions, spanning orthogonal and diagonal patterns (Zhou et al., 1 Aug 2025).
A distinctive design choice is that TopoMDCs do not introduce new parameters into convolution layers and inherit the pretrained convolution weights. Instead, the method patchifies the input into 4 non-overlapping patches and learns patch-specific routing weights 5. For patch 6, the output feature is
7
Here, 8 supplies the standard convolutional response, the eight 9 terms inject directional topology-aware differences, and 0 selects directionally relevant patterns on a patch basis (Zhou et al., 1 Aug 2025).
Stage 1 adapts only the router parameters via entropy minimization:
1
with update rule
2
The stated rationale for updating only 3 is to reduce search-space complexity, avoid interference between parameter updates, preserve pretrained representations, and provide sample-specific topological adaptation with greater stability (Zhou et al., 1 Aug 2025). This is empirically reinforced by the ablation in which updating all parameters underperforms router-only updating.
4. Stage 2: Topology Hard sample Generation and continuity refinement
Stage 2 addresses continuity failures that persist after structural adaptation. The mechanism is Topology Hard sample Generation, which constructs pseudo-break regions that resemble broken tubular structures and then trains the model to recover continuity under teacher-student prediction alignment (Zhou et al., 1 Aug 2025).
The first step is confident key-point selection. Given teacher prediction 4, the method keeps
5
then randomly samples
6
points from 7. The number of sampled points therefore grows with the amount of highly confident foreground (Zhou et al., 1 Aug 2025).
The second step slides a background window around each selected foreground point. For a point 8, a foreground window 9 of size 0 is centered on the point, and a same-sized background window is searched over nearby non-overlapping areas to find the region 1 with the lowest pseudo-label confidence. A lower threshold 2 rejects candidate background windows that still contain too much foreground (Zhou et al., 1 Aug 2025).
The third step creates pseudo-breaks through low-frequency swapping in the Fourier domain. With FFT, inverse FFT, and low-frequency mask 3,
4
and
5
Foreground pixels from the pseudo-label are then selectively replaced:
6
The resulting patch 7 is intended to weaken continuity while preserving essential foreground structure and avoiding the unnatural artifacts associated with crude corruption (Zhou et al., 1 Aug 2025).
Prediction alignment uses a teacher-student scheme. The teacher produces pseudo-labels 8 on the original image, while the student predicts 9 on the hard sample. The weighted consistency loss is
0
with weight map
1
The student is updated by
2
and the teacher is updated with EMA of student parameters (Zhou et al., 1 Aug 2025). Final inference is performed on the original, unmodified input.
5. Experimental profile, metrics, and ablations
TopoTTA is evaluated on 10 datasets grouped into four scenarios: retinal vessel segmentation (DRIVE, STARE, CHASEDB1), road extraction (DeepGlobe, Massachusetts road, CNDS), microscopic neuronal segmentation (Neub1, Neub2), and retinal OCT-angiography vessel segmentation (ROSE1, OCTA500) (Zhou et al., 1 Aug 2025). The reported metrics are Dice, clDice, and Betti error 3, with clDice emphasized because it evaluates skeleton-level continuity.
The headline result is an average 31.81% improvement in clDice over source-only testing across the four scenarios (Zhou et al., 1 Aug 2025). Average results over ten datasets are reported as follows.
| Backbone | Source Only | TopoTTA |
|---|---|---|
| U-Net | Dice 50.56, clDice 42.19, 4 51.94 | Dice 69.44, clDice 74.00, 5 43.01 |
| CS2Net | Dice 50.31, clDice 51.17, 6 54.35 | Dice 67.68, clDice 72.70, 7 43.86 |
Per-scenario examples further illustrate the topology-sensitive gains. On DRIVE 8 CHASE, TopoTTA reaches Dice 70.73, clDice 77.05, and 9 25.38. On CHASE 0 DRIVE, it reports Dice 72.96, clDice 70.26, and 1 79.15. On DeepGlobe 2 CNDS, it reports Dice 89.15, clDice 96.35, and 3 5.98. On ROSE 4 OCTA500, it reports Dice 70.70, clDice 78.24, and 5 31.88 (Zhou et al., 1 Aug 2025).
The ablation studies support both stages. A representative ablation reports: baseline at Dice 65.37, clDice 61.69, 6 82.24; baseline + TopoMDCs at Dice 68.70, clDice 65.14, 7 76.28; baseline8 + TopoHG at Dice 68.82, clDice 66.61, 9 73.63; and full TopoTTA at Dice 69.87, clDice 67.81, 0 73.27 (Zhou et al., 1 Aug 2025). The TopoMDC variant study shows the full eight-direction set outperforming CDC-only, orthogonal-only, and diagonal-only alternatives. The TopoHG comparison against Gaussian blur, random Gaussian noise, and spatial image swap attributes its advantage to preserving high-frequency cues while generating realistic pseudo-breaks (Zhou et al., 1 Aug 2025).
A practically important ablation compares updating all parameters with updating only the router parameters 1. The reported results favor router-only adaptation: Dice 70.73, clDice 77.05, 2 25.38 versus Dice 70.07, clDice 72.58, 3 30.23 when all parameters are updated. The paper also notes that 4 adds only 1280 parameters (Zhou et al., 1 Aug 2025). This directly contradicts the assumption that stronger test-time adaptation necessarily requires broader parameter updates.
Implementation details reinforce the lightweight design: all datasets are resized to 5; test-time adaptation uses six iterations per image, split as three for Stage 1 and three for Stage 2; Adam is used with Stage 1 learning rate 6 and Stage 2 learning rate 7; mask binarization uses threshold 8; and key TopoMDC/TopoHG hyperparameters include 9, window size 0, and 1 (Zhou et al., 1 Aug 2025).
6. Broader topology-aware TTA variants, limitations, and conceptual significance
Later work extended the same general intuition—topology as a deployment-time adaptation signal—into anomaly segmentation, but with a substantially different technical stack. A 2026 anomaly-segmentation method also named TopoTTA converts anomaly score maps into cubical complexes, computes persistent homology on sublevel and superlevel filtrations, retains the most persistent components as pseudo-labels, fuses them with an Euler-aware Intersection rule,
2
and trains only a lightweight shallow MLP called PCES on frozen backbone features using a margin-based contrastive loss; it is evaluated on MVTec AD, VisA, Real-IAD, MVTec 3D-AD, AnomalyShapeNet, and MVTec LOCO, and reports an average 3 F1 improvement over state-of-the-art methods (Zia et al., 26 Jun 2026). A closely related framework, TopoOT, uses multi-filtration persistence diagrams and Optimal Transport Chaining to derive geodesic stability scores, generate stability-aware pseudo-labels, and adapt a lightweight head online; it reports gains of up to +24.1% mean F1 on 2D datasets and +10.2% on 3D AS benchmarks (Zia et al., 28 Jan 2026).
These anomaly-segmentation methods show that the phrase “topology-aware TTA” no longer refers to a single mechanism. In the original TSS TopoTTA, topology enters through directional convolutions and synthetic continuity breaks. In the anomaly-segmentation variants, topology enters through persistent homology, cubical complex filtrations, Euler-consistent fusion, and, in TopoOT, entropy-regularized optimal transport across persistence diagrams (Zia et al., 26 Jun 2026, Zia et al., 28 Jan 2026). A plausible implication is that the term now denotes a family of methods united more by their use of structural invariants during test-time updating than by any single architectural recipe.
The limitations of the original TopoTTA remain specific and concrete. It is designed for CNN-based architectures, not arbitrary backbones. Stage 2 adds runtime cost because it requires patch selection and pseudo-break synthesis. Hyperparameters such as patch size, region count, and confidence thresholds matter. For some challenging cases, clDice may be undefined when skeletonization fails. The DSCNet variant omits Stage 1 because deformable kernels reduce compatibility with TopoMDCs, indicating that TopoMDC integration is not universal across all architectures (Zhou et al., 1 Aug 2025).
Conceptually, TopoTTA is significant because it reframes test-time adaptation for topology-sensitive segmentation as more than a distribution-calibration problem. In TSS, the framework explicitly separates adaptation to structural discrepancy from restoration of local continuity. In later anomaly-segmentation formulations, the same broader principle appears as persistent-homology-based pseudo-labeling that replaces brittle raw-score thresholding. Across these variants, the unifying proposition is that under domain shift, segmentation quality depends not only on confidence or pixel intensity but also on the preservation of connected components, holes, branch continuity, and related structural invariants (Zhou et al., 1 Aug 2025, Zia et al., 26 Jun 2026, Zia et al., 28 Jan 2026).