TL;DR
The paper introduces Scalar Function Topology Divergence (SFTD), a novel, differentiable topological tool that measures the multi-scale structural differences between two scalar functions. Unlike traditional topological methods that only count features like holes or cavities, SFTD accounts for where these features are spatially located. This makes it highly effective as a loss function for 2D and 3D computer vision tasks, outperforming existing methods in accuracy while running up to 35 times faster.
What Problem Does This Paper Address?
In computer vision tasks like 3D shape reconstruction or medical image segmentation, models are typically trained using pixel- or voxel-wise metrics (e.g., Dice score, cross-entropy). However, these metrics struggle to capture global structural correctness—they don't explicitly care if a reconstructed cell has an unrealistic hole through it or if a segmented tumor is split into disconnected pieces.
To fix this, researchers have turned to Topological Data Analysis (TDA), specifically using persistent homology to track structural features across scales. The standard approach measures the Wasserstein distance between "persistence barcodes" (summaries of when topological features appear and disappear).
The catch? Standard barcodes completely ignore spatial localization. Two shapes can have identical barcodes even if their topological features (like cavities) are in entirely different places. This paper bridges that gap by introducing a metric that enforces both topological similarity and correct spatial localization.
Methods
The authors propose two tightly coupled tools: F-Cross-Barcodes and Scalar Function Topology Divergence (SFTD).
- F-Cross-Barcodes: To compare two functions ($f$ and $g$), the authors construct a "doubled graph" $\tilde{\mathcal{G}}$ (or an extended $n+1$ dimensional lattice $\tilde{\mathcal{L}}$ for grid data) that links the domains of both functions together via an auxiliary vertex or dimension. They then define a new filtration function $\tilde{f}$ using combinations of $f$, $g$, and their element-wise minimums. The resulting persistence barcode captures exactly where the topology of $f$ diverges from $g$.
- SFTD: SFTD is calculated as the sum of the lengths of the intervals in the F-Cross-Barcode raised to a power $p$ (typically $p=1$ or $2$).
Crucially, the authors prove that SFTD is stable (robust to noise) and differentiable. By deriving its gradient, SFTD can be directly integrated into deep learning pipelines as a regularization loss term. For lattice structures (like 2D images or 3D volumes), they utilize cubical complexes rather than simplicial complexes to keep computational costs manageable.
Datasets
The method was evaluated across several synthetic and real-world datasets:
- Synthetic Data: 2D functions with local minima, 2D lattices with defects, and 3D concentric spheres with bridges.
- Graph Laplacian Eigenvectors: Evaluated on a random Watts-Strogatz small-world graph to demonstrate application on general graphs.
- 3D Shape Reconstruction: The "Red blood cell" and "Cell nuclei" datasets from the SHAPR framework (predicting 3D cell shapes from 2D fluorescence microscopy images).
- 3D Medical Segmentation: The BraTS 21 (Brain Tumor Segmentation) dataset.
- 2D Medical Segmentation: CREMI (electron microscopy of cellular structures) and Colon cancer cell datasets.
Key Insights and Ideas
- The "Aha!" Moment for Localization: If two functions have identical standard barcodes but different spatial layouts, their standard topological distance is zero. SFTD resolves this because the cross-barcode remains non-empty as long as the features don't align spatially.
- Mapping Back to Space: Because the birth and death of topological features in the F-Cross-Barcode correspond to specific vertices in the extended lattice, the authors can map these events back to the original 2D/3D space. This provides an intuitive visualization tool, highlighting exactly where a model's prediction is topologically erroneous.
- Exploiting Higher Homologies: In 3D data, calculating SFTD creates a 4D cubical complex, allowing the method to leverage $H_3$ homologies—a rare and powerful application of higher-order topology to real-world data.
Key Results
- Synthetic Validation: SFTD successfully distinguished shapes that standard Wasserstein distance deemed identical, yielding positive divergence scores and accurately pinpointing structural defects.
- 3D Reconstruction (SHAPR): Adding SFTD loss to the SHAPR baseline significantly reduced 3D shape matching errors (Intersection over Union, volume, and surface roughness). It also drastically improved higher-order topological accuracy ($H_2$ and $H_3$).
- 2D Segmentation Speed & Accuracy: When tested against Betti matching loss (a state-of-the-art topological loss), SFTD achieved lower topological errors ($\tau_{err}$ and $\beta_{err}$) on the CREMI and Colon datasets while being $\approx 35$ times faster to compute.
Limitations and Future Work
While SFTD is highly efficient in practice due to the sparsity of boundary matrices, its theoretical worst-case computational complexity is still cubic relative to the number of simplices or cubes involved. This could pose challenges for extremely high-resolution 3D volumes.
Additionally, SFTD is inherently asymmetric ($\text{SFTD}(f,g) \neq \text{SFTD}(g,f)$), requiring the authors to manually average the two directions in their loss functions. Future work could explore inherently symmetric formulations or further optimize the underlying cubical complex algorithms for larger datasets.
Summary updated