Probabilistic Watershed: Sampling all spanning forests for seeded segmentation and semi-supervised learning

Enrique Fita Sanmartin, Sebastian Damrich, Fred A. Hamprecht

Introduction

Seeded segmentation in computer vision and semi-supervised learning on graphs share a fundamental goal: given a few labeled nodes (seeds) and many unlabeled nodes, assign labels to the rest of the graph based on distance metrics.

The standard Watershed algorithm is a massively popular choice for this task due to its high efficiency. It operates by computing a minimum spanning forest (mSF) that connects every unlabeled pixel to a seed. However, Watershed is a combinatorial, "winner-takes-all" algorithm. It assigns a pixel to a single seed unequivocally, completely ignoring other slightly sub-optimal forests that might suggest a different label. This makes the algorithm brittle to noisy edge weights and incapable of expressing uncertainty—a major drawback when trying to integrate these algorithms into modern, end-to-end differentiable deep learning pipelines.

To address this, researchers have proposed the Probabilistic Watershed: instead of just finding the minimum forest, what if we compute a probability distribution over all possible spanning forests?

The Probabilistic Watershed

Rather than selecting a single minimum cost spanning forest, the Probabilistic Watershed defines a Gibbs distribution over all exponentially many spanning forests that separate the seeds. Forests with lower total edge costs are assigned higher probabilities.

Illustration of the Probabilistic Watershed, showing the distribution of spanning forests and the resulting probability map on a grid graph.

Naively calculating this is computationally impossible; even a small image patch can easily contain over $10^{11847}$ valid forests. To solve this intractable problem, the authors utilize Kirchhoff’s Matrix Tree Theorem (MTT). By manipulating the graph Laplacian and applying the MTT, they demonstrate that the partition function and the exact marginal probability of a node connecting to a specific seed can be computed in closed form by solving a simple linear system.

While previous work noted a connection between spanning forests and Random Walkers using electrical potential theory, this research provides a simpler, self-contained proof using elementary graph constructions.

Key Theoretical Insights

This theoretical reframing leads to several surprising and elegant mathematical insights:

  • Equivalence to the Random Walker: The authors mathematically prove that the Probabilistic Watershed (sampling all forests) is exactly equivalent to the Random Walker algorithm, which is also known as Laplacian Regularized Least Squares in machine learning. They formally prove that the Random Walker probabilities exactly equal the Probabilistic Watershed forest-sampling probabilities.
  • A Geometric Interpretation of Probability: The paper reveals a new interpretation of Random Walker probabilities. The probability of assigning a query node to a seed is directly proportional to the gap in the triangle inequality of the effective resistance between the seeds and the query node.
  • A New View of the Power Watershed: The Power Watershed algorithm can be understood as the zero-temperature limit of the Probabilistic Watershed. Instead of sampling all forests, the Power Watershed uniformly samples or counts only the minimum cost spanning forests (mSFs).

Built-in Uncertainty and Qualitative Results

By considering the ensemble of all forests, the Probabilistic Watershed naturally outputs an entropy or uncertainty map. It highlights ambiguous boundary regions where the standard Watershed might confidently make a mistake.

Uncertainty map generated by the Probabilistic Watershed, highlighting ambiguous boundary regions.

While this is primarily a theoretical paper, the authors provide qualitative validation using the CREMI (Circuit Reconstruction from Electron Microscopy Images) dataset. Visualizations confirm that the Probabilistic Watershed successfully captures segmentation uncertainty in ambiguous regions, whereas the standard Watershed fails silently.

Limitations and Future Work

The current mathematical framework relies heavily on the standard Matrix Tree Theorem, which applies exclusively to undirected graphs. Additionally, the authors note that the Random Walker interpretation breaks down in the absolute limit case (Power Watershed) because a random walker might get stuck oscillating on minimum-cost edges without ever reaching a seed. Fortunately, their new forest-counting interpretation survives this limit.

Looking forward, extending the Probabilistic Watershed framework to directed graphs using the directed generalization of the Matrix Tree Theorem is a primary goal. This would open the door to applying these robust semi-supervised learning techniques to directed networks like citation graphs, social networks, and the Web.

Summary updated

BibTeX
@inproceedings{sanmartin2019probabilistic,
  author = {Enrique Fita Sanmartin and Sebastian Damrich and Fred A. Hamprecht},
  title = {{Probabilistic Watershed: Sampling all spanning forests for seeded segmentation and semi-supervised learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
}
Figure