TL;DR
Traditional image segmentation losses focus on pixel overlap, often ignoring the underlying structure and connectivity (topology). This paper introduces Betti matching, the first differentiable loss and metric that guarantees spatially accurate topological matching between predicted segmentations and ground truth. By leveraging induced matchings from algebraic topology, it significantly improves structural correctness across diverse datasets without sacrificing pixel-level accuracy.
What Problem Does This Paper Address?
Standard neural networks for image segmentation are usually trained on pixel-wise losses like Cross-Entropy or Dice. While excellent for maximizing overall pixel overlap, these objectives fail miserably at preserving topology—such as ensuring a blood vessel or road network is continuously connected, or preventing artificial holes in a cell wall.
To fix this, researchers previously turned to persistent homology (a tool from algebraic topology) to create topology-aware losses, most notably the Wasserstein loss. However, these methods have a glaring flaw: they match topological features based purely on their contrast or persistence, completely ignoring where they are in the image. As a result, a hole on the top-left of a prediction could be matched to a hole on the bottom-right of the ground truth. This spatial mismatch leads to unhelpful or even destructive gradients during training.
Methods
The authors propose Betti Matching, a framework that ensures topological features (connected components and cycles) are only matched if they are spatially coincident.
- Ambient Space Comparison: Instead of comparing the prediction likelihood map ($L$) and the ground truth ($G$) independently, they construct a common "comparison image" $C = \max(L, G)$ (for superlevel sets). This acts as a shared space containing both filtrations.
- Induced Matchings: Using the algebraic concept of induced matchings between persistence barcodes, features from $L$ and $G$ are mapped into $C$. If a feature from the prediction and a feature from the ground truth map to the exact same feature in the comparison image, they are formally matched.
- Differentiable Loss: Because the birth and death times of these topological features correspond to specific pixel intensities, the Betti matching error is fully differentiable. This allows it to be combined with standard Dice loss for backpropagation: $$\mathcal{L}_{train} = \alpha \mathcal{L}_{BM} + \mathcal{L}_{dice}$$
Datasets
The method was validated across six datasets representing distinct structural and topological challenges:
- CREMI (Neuron Segmentation): Curvilinear, network-like structures with a high number of cycles.
- Massachusetts Roads: Complex road networks with frequent connectivity challenges.
- C. elegans: Microscopy infection images consisting of a balanced number of components and cycles.
- synMnist: A synthetic, noisy MNIST variant designed to test balanced topological features.
- Colon Cancer Cell: Blob-like foreground structures primarily requiring dimension-0 (connected component) accuracy.
- Massachusetts Buildings: Another blob-like dataset focusing on individual building footprints.
Key Insights and Ideas
- The Spatial Blindspot of Wasserstein Loss: The authors discovered that on complex datasets like CREMI, the popular Wasserstein topological loss matches cycles incorrectly over 99% of the time early in training. Betti matching completely resolves this by forcing spatial correspondence.
- Smart Gradients: When a predicted topological feature is correctly matched to the ground truth, Betti matching's gradient amplifies its local contrast. Conversely, if a predicted feature is unmatched (a false positive), the gradient suppresses it.
- A Sharper Metric: Betti number error ($\beta^{err}$) only counts the number of features. Betti matching error ($\tau^{err}$) acts as a "sharpened" version that penalizes spatial displacement, making it a much more reliable evaluation metric for structural fidelity.
Key Results
- Topological Superiority: Across all six datasets, Betti matching consistently achieved the lowest topological errors ($\tau^{err}$ and $\beta^{err}$) for both dimension-0 (components) and dimension-1 (loops) features compared to Dice, clDice, and Wasserstein baselines.
- Preserved Volumetric Performance: Crucially, cleaning up the structure did not come at the cost of pixel accuracy; standard volumetric metrics like Dice and Accuracy remained competitive or superior to the baselines.
- Qualitative Improvements: Visual inspections of the segmentations show significantly fewer broken connections in road networks and cleaner, more accurate cell boundaries with fewer hallucinated loops.
Limitations and Future Work
- Computational Complexity: Computing persistent homology requires a matrix reduction step with a cubic time complexity ($O(n^3)$ relative to the number of pixels). While mitigated by Union-Find and clearing tricks, it remains significantly slower than standard pixel-wise losses.
- 2D Constraint: The current implementation is restricted to 2D images. While the underlying mathematical guarantees theoretically extend to 3D volumes (such as medical CT or MRI scans), adapting the algorithm efficiently to 3D remains an open direction for future work.
Summary updated