Topology-Preserving Deep Image Segmentation

Xiaoling Hu, Fuxin Li, Dimitris Samaras, Chao Chen

TL;DR

Standard deep learning segmentation models frequently break thin connections or merge boundaries because per-pixel losses treat all pixels equally. This paper introduces a differentiable, continuous topological loss based on persistent homology that directly penalizes discrepancies in topological features (Betti numbers like loops and connected components). Minimizing this loss guarantees topological correctness at zero, yielding models that segment fine-scale structures such as neurons, blood vessels, and road networks with dramatically fewer disconnections.

What Problem Does This Paper Address?

Standard deep segmentation networks optimize pixel-wise metrics like cross-entropy. However, in tasks involving thin, continuous structures—such as neuron cell membranes, retinal blood vessels, or road networks—a mistake of just one or two pixels can sever a crucial connection or bridge two disjoint regions.

In biomedical contexts like connectomics, a broken membrane can spuriously merge two adjacent neurons into one, causing catastrophic functional interpretation errors despite achieving >96% pixel accuracy. Because discrete topological properties (like the number of holes or connected components, formally known as Betti numbers) cannot be directly differentiated, conventional neural network training has largely ignored topological priors during optimization.

Methods

The authors propose TopoLoss, a differentiable objective integrated into end-to-end training: $$\mathcal{L}(f, g) = \mathcal{L}_{\text{bce}}(f, g) + \lambda \mathcal{L}_{\text{topo}}(f, g)$$ where $f$ is the continuous predicted likelihood map and $g$ is the binary ground truth.

  • Persistent Homology over Superlevel Sets: Rather than evaluating topology at a fixed threshold (e.g., 0.5), the method examines superlevel sets $f^\alpha = \{x \mid f(x) \ge \alpha\}$ across all $\alpha \in [0, 1]$. As $\alpha$ varies, topological structures (components and loops) appear ("birth") and disappear ("death"), recorded as dots in a 2D persistence diagram.
  • Modified Wasserstein Distance Loss: The loss calculates the minimum-cost matching between dots in the predicted diagram $\text{Dgm}(f)$ and the ground truth diagram $\text{Dgm}(g)$. Dots corresponding to spurious noise in $f$ are penalized by matching them to the diagonal.
  • Topological Guarantee & Gradients: The authors prove that when $\mathcal{L}_{\text{topo}} = 0$, thresholding $f$ at 0.5 yields the exact Betti numbers of the ground truth. The loss is piecewise differentiable because birth and death thresholds correspond to specific pixel locations (critical points / saddle points). Gradients directly "push" or "pull" these saddle points up or down to restore broken connections.
  • Relative Homology on Local Patches: Because computing persistent homology over full images is computationally prohibitive and sensitive to global matching complexity, training samples overlapping $65 \times 65$ patches. Boundary-relative homology (effectively padding a frame) allows the framework to properly monitor open, branching structures (like Y-junctions).

Datasets

The authors evaluated the method across six public benchmarks spanning biomedical, road, and material domains:

  1. CREMI: 125 electron microscopy (EM) serial sections ($1250 \times 1250$) for neuron membrane segmentation.
  2. ISBI12 & ISBI13: EM neuron segmentation benchmarks containing 30 ($512 \times 512$) and 100 ($1024 \times 1024$) images, respectively.
  3. DRIVE: 20 retinal fundus images ($584 \times 565$) for blood vessel segmentation.
  4. CrackTree: 206 road pavement images ($600 \times 800$) for crack detection.
  5. Road (Massachusetts Roads): 1,108 aerial images ($1500 \times 1500$) for road network extraction.

(No new benchmarks were introduced; all experiments used 3-fold cross-validation).

Key Insights and Ideas

  • Combating Sampling Bias: Difficult, blurry pixels on thin membranes make up an tiny fraction of total training pixels. Standard cross-entropy virtually ignores them, but topological loss explicitly finds these critical failure points and forces the network to correct them.
  • Direct Saddle-Point Intervention: The gradient update explicitly targets the "critical points" responsible for topological transitions. If a vessel is broken, the gradient specifically pushes up the likelihood at the gap's saddle point.
  • Thickening Labels Fails: A naive baseline—dilating ground-truth masks by 1 or 2 pixels—did not resolve topological disconnects (yielding Betti errors of 4.126 and 4.431 on CREMI, versus 1.113 for TopoLoss). Topology is structural, not simply a matter of line thickness.

Key Results

TopoLoss was compared against baseline networks (DIVE, U-Net) and a CNN feature-based topology loss (Mosinska et al.):

  • Betti Number Error: TopoLoss achieved dramatic reductions across all datasets. On ISBI12, the Betti error dropped from 3.187 (DIVE) and 2.785 (U-Net) down to 0.429. On CREMI, it dropped from 4.378 (DIVE) to 1.113.
  • Clustering / Partition Metrics: On CREMI, TopoLoss improved the Adapted Rand Index (ARI) to 0.8083 (vs. 0.6532 for DIVE) and decreased Variation of Information (VOI) to 1.462 (vs. 2.513 for DIVE).
  • Pixel Accuracy Maintained: TopoLoss achieved these topological improvements without sacrificing standard pixel accuracy (e.g., 98.26% on CrackTree, 97.28% on Road).

Limitations and Future Work

  • Patch-Size Restriction: The cubic complexity of matrix reduction in persistent homology forces the use of small patches ($65 \times 65$), limiting long-range topological modeling across whole images in a single step.
  • Hyperparameter Sensitivity: The topological weight $\lambda$ is very small ($\approx 10^{-4}$) and requires careful tuning via cross-validation; setting $\lambda$ too high slightly compromises per-pixel accuracy due to overfitting at critical pixels.
  • Scope: The implementation focuses primarily on 2D images and 0- and 1-dimensional homology (components and loops), leaving 3D volume topology and higher-dimensional voids for future work.
  • Dependency on Pixel Loss: Topological loss cannot train a network from scratch; without cross-entropy providing an initial reasonable likelihood map, topology on random noise is uninformative.

Summary updated

BibTeX
@inproceedings{hu2019topology,
  author = {Xiaoling Hu and Fuxin Li and Dimitris Samaras and Chao Chen},
  title = {{Topology-Preserving Deep Image Segmentation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=vpYtVd_S76p},
}
Figure