Topograph: An Efficient Graph-Based Framework for Strictly Topology Preserving Image Segmentation

Laurin Lux, Alexander H Berger, Alexander Weers, Nico Stucki, Daniel Rueckert, Ulrich Bauer, Johannes C. Paetzold

TL;DR

Topograph introduces a highly efficient, graph-based loss framework for image segmentation that strictly preserves topological structures (like connectivity and holes) without sacrificing pixel-wise accuracy. By constructing a component graph to isolate topologically critical errors, it achieves state-of-the-art performance while computing the loss up to five times faster than existing persistent homology methods.

What Problem Does This Paper Address?

In many image segmentation tasks—especially in medical imaging (e.g., blood vessels, neurons) or satellite imagery (e.g., road networks)—getting the topology right is just as important as getting the pixels right. A single misclassified pixel can break a continuous blood vessel in half or merge two distinct cells, leading to catastrophic downstream failures in structural analysis.

Graph overlay on aerial imagery

Standard loss functions like Dice or Cross-Entropy are "pixel-wise"; they treat every pixel independently and don't care if a tiny error breaks a critical connection. To fix this, researchers have developed "topology-aware" methods. However, current solutions are either highly task-specific (like clDice, which only works well for tubular structures), lack strict mathematical guarantees, or rely on Persistent Homology (PH), which is computationally expensive and scales poorly to large images. The authors of this paper set out to build a topology-preserving loss function that is mathematically rigorous, universally applicable, and computationally cheap.

Methods

At the heart of Topograph lies the Combined Component Graph $\mathcal{G}(P, G)$. Instead of looking at the prediction ($P$) and ground truth ($G$) separately, the method overlays them to create a 4-class image: True Positives, True Negatives, False Positives, and False Negatives.

Topograph methodology pipeline

From this overlay, the method builds a bipartite graph where nodes represent connected components (superpixels) of these four classes. The authors then apply a clever filtering step:

  1. Regular vs. Critical Nodes: The algorithm analyzes the local neighborhood of each incorrectly predicted node. If a misclassified node has exactly one correct foreground neighbor and one correct background neighbor, it is deemed "regular"—meaning it alters the boundary but doesn't change the underlying topology (no broken connections, no new holes). If it doesn't meet this criteria, it is a "critical" node.
  2. Targeted Loss: The Topograph loss function aggregates pixel scores only from these critical nodes. It essentially tells the neural network: "Ignore the minor boundary wiggles, but heavily penalize the pixels that are breaking connections or creating false holes."

Additionally, the authors introduce a novel evaluation metric called DIU (Discrepancy between Intersection and Union). DIU measures topological accuracy by checking the homotopy equivalence (structural similarity) between the intersection of the prediction/label and their union.

Key Insights and Ideas

  • Don't sweat the small stuff: By mathematically proving that "regular" nodes do not alter the homotopy type of the prediction, the authors elegantly decouple pixel-level boundary refinement from topological correctness. This allows the network to focus its gradients exactly where they matter most.
  • Union vs. Intersection is a stricter test: The new DIU metric is a massive conceptual upgrade. Standard topological metrics might say a prediction is correct if it has the right number of holes and components, even if they are spatially misaligned. By enforcing topological equivalence between the union and intersection of the prediction and ground truth, Topograph guarantees strict spatial correspondence.
  • Graph algorithms beat complex algebra for speed: Persistent Homology relies on complex algebraic topology computations that scale at $\mathcal{O}(n \log n)$. Topograph leverages simple connected-component labeling and planar graph properties, bringing the asymptotic complexity down to near-linear time $\mathcal{O}(n \cdot \alpha(n))$.

Datasets and Key Results

The authors evaluated Topograph on a mix of binary and multi-class datasets spanning biological, medical, and aerial domains, including Cremi (fly brain cells), Roads/Buildings (aerial imagery), Platelet (dense cellular segmentation), and TopCoW (blood vessel segmentation).

  • State-of-the-Art Topology: Topograph consistently outperformed or matched baselines (Dice, clDice, HuTopo, Betti Matching) across strict topological metrics (DIU and Betti Matching error) on almost all datasets.
  • Maintained Pixel Accuracy: The strict topological focus did not degrade standard pixel-wise accuracy; Dice scores remained highly competitive with models trained purely on Dice loss.
  • Massive Speedup: Topograph is incredibly fast. In empirical tests, the average loss calculation took ~96 ms, compared to ~327 ms for Betti Matching and ~603 ms for HuTopo. Over a full training run on the Platelet dataset, Topograph saved up to an hour of compute time compared to PH-based methods.

Limitations and Future Work

  • Binarization Trade-off: To build the component graph quickly, Topograph requires binarizing the network's probability map at a specific threshold (e.g., 0.5). While the authors mitigate this by randomly jittering the threshold during training, it still discards some of the continuous topological information that Persistent Homology naturally captures via filtrations.
  • 2D Limitation: The current framework and mathematical proofs are designed for 2D images. Extending this graph-based approach to 3D volumes is a highly promising, though complex, direction for future work.

Summary updated

BibTeX
@inproceedings{lux2025topograph,
  author = {Laurin Lux and Alexander H Berger and Alexander Weers and Nico Stucki and Daniel Rueckert and Ulrich Bauer and Johannes C. Paetzold},
  title = {{Topograph: An Efficient Graph-Based Framework for Strictly Topology Preserving Image Segmentation}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=Q0zmmNNePz},
}
Figure