Deep learning models are incredibly good at identifying textures and patterns, but they often struggle with the "big picture" of structure. In medical imaging, a model might correctly identify 99% of the pixels in a blood vessel but fail to connect two segments, rendering the segmentation useless for clinical analysis. Persistent Homology (PH) is a mathematical tool that tracks these topological features (like connected components and loops), but it has historically been too slow to use effectively during the training of deep neural networks.
CuPH (pronounced "cup-H") changes this by introducing a highly parallel GPU algorithm that makes topological computations up to 100x faster, finally making full-image topological losses practical for high-resolution data.
TL;DR
CuPH is a new GPU-based algorithm that parallelizes the computation of cubical persistent homology for 2D images. By operating directly on pixels and using a level-synchronous sweep, it achieves nearly 100x speedups over previous GPU baselines, allowing deep learning models to maintain global structural integrity (like connected road networks or blood vessels) during training.
What Problem Does This Paper Address?
Standard deep learning loss functions, like Cross-Entropy or Dice, operate pixel-by-pixel. They don't "know" if a predicted vessel is a single continuous tube or a series of broken fragments. Persistent Homology can measure these structural properties, but standard algorithms are inherently sequential.
For an image with $n$ pixels, traditional methods have a "parallel depth" of $\Theta(n)$, meaning they have to process elements one after another. This makes them a massive bottleneck on GPUs, which thrive on doing thousands of things at once. Because of this, researchers previously had to rely on "patch-local" PH—calculating topology only on tiny sub-sections of an image—which misses global connectivity patterns.
Methods
The authors introduce CuPH, which shifts the paradigm from processing individual "cells" (vertices, edges, and squares) to processing pixel levels in parallel.
- Level Bucketing: Instead of sorting all $4n$ cells of a cubical complex, CuPH groups pixels into buckets based on their intensity levels ($L$). Since an 8-bit image only has 256 levels, this drastically reduces the number of sequential steps.
- Level-Synchronous Sweep: The algorithm processes these levels one by one. However, within each level, all pixels are activated and merged into connected components in parallel.
- Lock-Free Component Tracking: To handle the "merging" of components on the GPU without slowing down, CuPH uses a lock-free union-find structure. It employs atomic "compare-and-swap" (CAS) operations to ensure that multiple threads can update the connectivity map simultaneously without data corruption.
This approach reduces the parallel depth from $\Theta(n)$ to $O(L \log n)$. For a million-pixel image, this is the difference between a million sequential steps and a few hundred.
Datasets
The authors evaluated CuPH across a wide range of domains:
- Classification: ISIC 2018 (Skin lesions), CBIS-DDSM (Mammography), Prostate Cancer histology, and APTOS 2019 (Retinopathy).
- Segmentation: ISIC 2018, CREMI (Electron microscopy of neurons), and Synapse (Abdominal CT).
- Topology-Aware Loss: Massachusetts Roads (aerial imagery) and Platelet (EM) datasets.
Key Insights and Ideas
- Exploiting Discrete Intensity: The "aha moment" is realizing that image filtrations are naturally bounded by the number of intensity levels ($L$). We don't need to process every pixel as a unique event; we can process all pixels of the same "brightness" simultaneously.
- Pixel-Centricity: By operating directly on pixels and using Alexander Duality to handle loops ($H_1$), the algorithm avoids the memory overhead of explicitly building a complex of vertices, edges, and squares.
- Single-Kernel Execution: The entire level sweep is implemented in a single CUDA kernel. This eliminates the overhead of launching thousands of tiny kernels, which is often what kills performance in other GPU-based topological methods.
Key Results
- Raw Speed: CuPH is 18.6x to 99.6x faster than the previous state-of-the-art GPU baseline (CMP). Compared to the fastest CPU-based methods, it is over 10x faster at standard resolutions.
- Training Acceleration: When used as a "drop-in" replacement for topological backends in deep learning, it accelerates training by 25x to 31x.
- Better Accuracy: Because CuPH is fast enough to run on full high-resolution images (rather than small patches), it improved segmentation accuracy (Dice score) by 2.2 to 4.6 points. It captures global structures that patch-based methods simply cannot see.
Limitations and Future Work
- 2D Constraint: Currently, CuPH is optimized for 2D images. Extending this to 3D (like MRI or CT volumes) is more complex because the mathematical trick used to find loops (Alexander Duality) doesn't simplify the middle dimensions of 3D data as easily.
- Quantization: For floating-point data, CuPH requires quantizing values into discrete levels. While the authors prove this is stable, very high-precision scientific data might require a large $L$, which could slow the algorithm down.
- Future Directions: The authors suggest exploring adaptive quantization (focusing levels where the data is most dense) and extending the parallel reduction techniques to 3D homology.
Summary updated