---
title: 'SDF-TopoNet: Topology-Aware Segmentation'
url: https://www.emergentmind.com/topics/sdf-toponet
type: topic
---

# SDF-TopoNet: Topology-Aware Segmentation

SDF-TopoNet is a topology-aware segmentation framework for tubular and curvilinear structures that combines signed distance function pre-training with persistent-homology-based fine-tuning. It is designed for settings in which pixel-level overlap is insufficient because small discontinuities in thin branches can alter connectivity and change Betti numbers, thereby degrading downstream tasks such as path tracing and graph extraction. The method, introduced in “SDF-TopoNet: A Two-Stage Framework for Tubular Structure Segmentation via SDF Pre-training and Topology-Aware Fine-Tuning,” uses a two-stage procedure: first, a U-Net regresses signed distance fields; second, the learned representation is adapted to binary segmentation using a dynamic adapter and a Dice-weighted topological loss [2503.14523].

## 1. Problem formulation and motivation

The framework addresses segmentation of tubular and curvilinear structures, including retinal vessels, neurons in electron microscopy, and road networks. In these domains, segmentation quality is not determined solely by overlap-based metrics. A small gap in a vessel or neurite can split a connected component, eliminate a cycle, or otherwise alter the topology of the segmented object. The paper therefore frames the task as requiring both local boundary fidelity and global structural correctness [2503.14523].

The motivation is articulated against two limitations of prior topology-aware segmentation methods based on persistent homology. First, persistent-homology losses are computationally expensive because they require persistence-diagram computation and matching, including Betti matching or Wasserstein-style distances. The detailed description notes that previous works often restrict training to small patches such as \(65 \times 65\) or \(48 \times 48\). Second, purely topological losses are relatively insensitive to local pixel accuracy, so they are commonly paired with Dice or mean squared error losses to preserve boundary precision. SDF-TopoNet is proposed as a response to both limitations by moving part of the topology-related supervision into a less expensive pre-training stage.

A central premise of the method is that signed distance functions provide a continuous signal that encodes boundary proximity and topology-relevant geometric structure. This suggests a division of labor between stages: distance-based representation learning first, explicit topological correction later. A plausible implication is that this decomposition reduces the need to optimize expensive topological objectives from random initialization.

## 2. Topological background and signed distance functions

The paper formulates topology in the language of cubical complexes, which are natural for images. For a cubical complex \(K\) with chain complex
$$
C_*(K) = (\{C_d(K)\}_{d \in \mathbb{Z}}, \{\partial_d\}_{d \in \mathbb{Z}}),
$$
the boundary operators satisfy
$$
\partial_{k-1} \circ \partial_k \equiv 0.
$$
Cycles and boundaries are defined as
$$
Z_d(K) = \mathrm{Ker}(\partial_d), \qquad B_d(K) = \mathrm{Im}(\partial_{d+1}),
$$
and the homology group and Betti numbers are
$$
H_k(K) = Z_k(K) / B_k(K), \qquad \beta_k(K) = \dim H_k(K).
$$
In image analysis, \(\beta_0\) counts connected components, \(\beta_1\) counts loops or cycles in 2D, and \(\beta_2\) counts voids in 3D [2503.14523].

Persistent homology is used to characterize the birth and death of topological features across a filtration, with persistence diagrams collecting the corresponding \((b,d)\) pairs. Within SDF-TopoNet, this machinery appears most explicitly during fine-tuning, but the pre-training stage is motivated by the observation that signed distance fields align naturally with distance-based filtrations.

The signed distance function is given using the formulation attributed to Malladi et al. Let \(\Omega\) be the set of points inside the object. The unsigned distance is
$$
|f(x)| = g(x) = \inf_{y \in \Omega} \|x-y\|, \qquad x \in \mathbb{R}^{n},
$$
and the signed function is
$$
f(x)=
\begin{cases}
g(x), & \text{if } x \in \Omega,\\
-g(x), & \text{if } x \notin \Omega.
\end{cases}
$$
In implementation, the SDF is computed from ground-truth masks using Euclidean Distance Transform:
$$
\mathrm{EDT}(x) = \min_{y \in \Omega} \|x-y\|,
$$
with the final representation
$$
\mathrm{SDF}(x)= \mathrm{EDT}_{\mathrm{background}}(x) - \mathrm{EDT}_{\mathrm{foreground}}(x).
$$
Under this convention, SDF values are positive inside the object, zero on the boundary, and negative outside. The paper states that this representation is robust to small pixel noise and encodes distance to boundaries in a way that aligns with persistent-homology filtrations.

## 3. Two-stage framework and architecture

SDF-TopoNet uses a U-Net with an EfficientNet-B0 encoder as its backbone. The training protocol is explicitly divided into two stages. In the first stage, the network is trained as an SDF regressor. In the second stage, the original segmentation head is replaced by a dynamic adapter, and the model is fine-tuned for binary segmentation with a topology-aware objective [2503.14523].

During pre-training, the network outputs an SDF field for each image or patch. The target is the SDF computed from the ground-truth mask, and the loss is mean squared error. Conceptually, the objective is
$$
L_{\mathrm{sdf}} = \|\hat{\phi}(x) - \phi(x)\|_2^2,
$$
implemented as MSE. The optimizer is Adam, and the schedule is 200 epochs of SDF regression. Images are cropped into smaller patches, and no additional smoothing or normalization beyond EDT is reported.

The paper emphasizes that SDF thresholds can close gaps in thin structures: lowering the threshold enlarges segmented regions and can restore connectivity. This observation motivates the dynamic transformation from continuous SDF features to binary masks. Rather than treating the SDF prediction as an end in itself, the method uses it as an intermediate representation that is subsequently adapted for segmentation.

The dynamic adapter is attached to the U-Net decoder outputs, described as SDF feature maps. Its role is to map continuous distance-informed features to binary masks while adapting to local context. The adapter has three described components: a large-kernel depthwise separable convolution that reconstructs or modulates feature maps from the backbone; a squeeze module consisting of global average pooling and a small feed-forward network for channel-wise scaling; and a variant that flattens features, applies a fully connected layer, and uses a \(\tanh\) activation to predict a threshold for binarization. The detailed description therefore presents the adapter as combining feature modulation with dynamic threshold prediction.

## 4. Fine-tuning objective and topological losses

The second stage performs topology-aware fine-tuning for 100 epochs using a weighted combination of Dice loss and a topological loss. The objective is
$$
L(s,g) = \alpha L_M(s,g) + (1-\alpha)L_{\mathrm{Topo}}(s,g),
$$
where \(s\) is the predicted segmentation, \(g\) is the ground truth, \(L_M\) is Dice, and \(\alpha = 0.9\) in all reported configurations. The topological term is selected as either Wasserstein Matching or Betti Matching:
$$
L_{\mathrm{Topo}}(s,g)=
\begin{cases}
L_{\mathrm{WM}}(s,g), & \text{if Wasserstein Matching},\\
L_{\mathrm{BM}}(s,g), & \text{if Betti Matching}.
\end{cases}
$$
During this stage, supervision uses ground-truth masks rather than SDFs [2503.14523].

For matching stability, the method pads a 2-pixel-wide bounding box around masks before computing persistence diagrams. The paper states that this “adds additional topological features,” increasing the number of diagram points and improving matching effectiveness for both Wasserstein and Betti matching.

The Wasserstein Matching loss is defined on persistence diagrams \(D_1\) and \(D_2\) as
$$
W_p(D_1, D_2) = \left( \inf_{\gamma \in \Gamma(D_1, D_2)} \sum_{(c,c') \in \gamma} \|c-c'\|^p \right)^{1/p},
$$
where \(\Gamma(D_1,D_2)\) is the set of valid matchings and \(\|\cdot\|\) is Euclidean distance. This is the Earth Mover’s Distance formulation over birth-death points in the persistence diagrams.

The Betti Matching loss is defined using induced matchings in a common filtration space. Given binarized prediction \(P\) and ground truth \(G\), the common space is
$$
C = \min(P,G),
$$
applied element-wise. The induced matching is
$$
\mu(P,G)=\sigma(G,C)^{-1} \circ \sigma(P,C),
$$
where \(\sigma(P,C): B(P)\to B(C)\) and \(\sigma(G,C): B(G)\to B(C)\) are induced mappings on barcodes. The loss is
$$
L_{\mathrm{BM}}(P,G)=\sum_{q \in \mathrm{Dgm}(P)} 2\|q-\mu(P,G)(q)\|^2.
$$
The paper notes that the factor of \(2\) normalizes the matching error.

The method’s stated rationale is that SDF pre-training supplies smooth, distance-based features before expensive topology optimization begins, while the fine-tuning stage restores explicit topological supervision. This suggests a hybrid regime in which persistent homology is reserved for late-stage correction rather than early-stage representation formation.

## 5. Evaluation protocol and empirical results

The detailed experimental description reports evaluation on four public benchmarks: DRIVE for retinal vessel segmentation, CREMI for electron-microscopy neuron segmentation, Massachusetts Roads for road segmentation, and Elegans as a biomedical dataset with both \(\beta_0\) and \(\beta_1\) features. The abstract states that the method is evaluated on five benchmark datasets, whereas the detailed dataset list enumerates these four. The reported split is \(14{:}3{:}3\) for train, validation, and test. Pre-training uses cropped patches for EDT-based SDF computation; fine-tuning uses \(64 \times 64\) patches for Wasserstein Matching and \(32 \times 32\) patches for Betti Matching, with sliding-window sampling at test time [2503.14523].

The evaluation includes standard segmentation metrics—Dice, Intersection over Union, Pixel Accuracy, and Variation of Information—as well as clDice. The paper describes clDice as a topology-preserving overlap measure based on skeletons \(S_L\) and \(S_P\), following Shit et al. 2021. The paper also discusses topology through Betti numbers, but the reported evaluation uses clDice and persistent matching losses or errors rather than explicit formulas for Betti error.

Baselines include a Dice-only U-Net, Hu et al. using TopoLoss or Wasserstein Matching on persistence diagrams, and Stucki et al. using Betti Matching. The reported model configurations comprise a pure Dice U-Net; U-Net plus Dice and Wasserstein Matching; U-Net plus Dice and Betti Matching; and two SDF-TopoNet variants that use SDF pre-training followed by dynamic-adapter fine-tuning with Dice plus either Wasserstein Matching or Betti Matching.

The key quantitative outcomes reported for the Wasserstein-based SDF-TopoNet variant are summarized below.

| Dataset | Dice comparison | clDice |
|---|---|---|
| DRIVE | Ours 0.716; Dice 0.243; Hu et al. 0.123; Stucki et al. 0.267 | 0.758 |
| CREMI | Ours 0.872; Dice 0.790; Hu et al. 0.849; Stucki et al. 0.832 | 0.929 |
| Roads | Ours 0.616; Dice 0.598; Hu et al. 0.582; Stucki et al. 0.537 | 0.690 |
| Elegans | Ours 0.880; Dice 0.863; Hu et al. 0.817; Stucki et al. 0.838 | 0.951 |

The paper states that the SDF-TopoNet Wasserstein variant achieves the best clDice on all four listed datasets. On DRIVE, the reported gain over the Dice baseline is especially large. On CREMI, Roads, and Elegans, the method also improves Dice relative to the listed baselines while maintaining the highest clDice. The reported interpretation is that the framework improves both pixel overlap and topology preservation.

An ablation on CREMI in the Wasserstein setting isolates the effect of SDF pre-training. With SDF pre-training enabled, the reported scores are Dice \(0.872\), IoU \(0.775\), PA \(0.930\), VoI \(0.498\), and clDice \(0.929\). With SDF disabled while retaining a two-stage process and the same final target as the final mask, the scores are Dice \(0.842\), IoU \(0.734\), PA \(0.929\), VoI \(0.568\), and clDice \(0.897\). The authors conclude that SDF pre-training improves both pixel overlap and topology, as reflected by higher clDice and lower VoI.

## 6. Computational profile, limitations, and place in the literature

The runtime analysis is reported for a single NVIDIA A40 GPU. Dice-only training requires 100 epochs at \(1.2\) s/epoch for a total of \(1\)m\(57\)s. Hu et al. with Wasserstein Matching requires \(11.2\) s/epoch for a total of \(18\)m\(37\)s. Stucki et al. with Betti Matching requires \(1\)m\(27.8\)s/epoch for a total of \(2\)h\(26\)m\(19\)s. SDF-TopoNet with Wasserstein Matching performs \(200\) pre-training epochs at \(1.3\) s/epoch plus \(100\) fine-tuning epochs at \(11.2\) s/epoch, yielding \(4\)m\(12\)s \(+\) \(18\)m\(37\)s \(=\) \(22\)m\(49\)s. SDF-TopoNet with Betti Matching yields \(4\)m\(12\)s \(+\) \(2\)h\(26\)m\(19\)s \(=\) \(2\)h\(30\)m\(31\)s [2503.14523].

These measurements support two points made explicitly in the paper. First, persistent-homology losses remain expensive, with Betti Matching especially costly. Second, SDF pre-training adds only about \(4\)m\(12\)s of overhead in the reported setup, while the ablation suggests substantial gains in segmentation quality. The paper further notes that SDF pre-training may accelerate convergence, suggesting that fewer fine-tuning epochs could suffice, although no reduced-epoch experiment is reported.

Several limitations are stated. Extremely thin or very low-contrast branches remain difficult; if SDF prediction is noisy near boundaries, learned thresholds may over-expand or under-expand structures. Betti Matching remains computationally heavy, and patch-based training is still required, which limits whole-image topology optimization. Domain shifts across modalities, such as from electron microscopy to fundus imagery, may affect SDF regression quality; the paper suggests that additional normalization or domain adaptation could help. It also does not report sensitivity to hyperparameters such as \(\alpha\) or adapter configuration, and does not provide memory usage.

Within the broader topology-aware segmentation literature, SDF-TopoNet is positioned as a hybrid between overlap-based supervision and direct persistent-homology optimization. Its distinctive contribution is the decoupling of distance-informed representation learning from expensive topological matching. This suggests a general design pattern for topology-critical segmentation: pre-train on a continuous field aligned with filtration geometry, then apply explicit topological losses only after a useful structural representation has already formed. The paper’s released code is hosted at `https://github.com/siyiwu0330/SDF-TopoNet/`, and the implementation notes mention that persistent-homology computations can be implemented with torch-topological, giotto-tda, or GUDHI.

Source: https://www.emergentmind.com/topics/sdf-toponet