Secrets of GrabCut and Kernel K-means

Meng Tang, Ismail Ben Ayed, Dmitrii Marin, Yuri Boykov

Abstract

We propose a new segmentation model combining common regularization energies, e.g. Markov Random Field (MRF) potentials, and standard pairwise clustering criteria like Normalized Cut (NC), average association (AA), etc. These clustering and regularization models are widely used in machine learning and computer vision, but they were not combined before due to significant differences in the corresponding optimization, e.g. spectral relaxation and combinatorial max-flow techniques. On the one hand, we show that many common applications using MRF segmentation energies can benefit from a high-order NC term, e.g. enforcing balanced clustering of arbitrary high-dimensional image features combining color, texture, location, depth, motion, etc. On the other hand, standard clustering applications can benefit from an inclusion of common pairwise or higher-order MRF constraints, e.g. edge alignment, bin-consistency, label cost, etc. To address joint energies like NC+MRF, we propose efficient Kernel Cut algorithms based on bound optimization. While focusing on graph cut and move-making techniques, our new unary (linear) kernel and spectral bound formulations for common pairwise clustering criteria allow to integrate them with any regularization functionals with existing discrete or continuous solvers.

Introduction: The Local-Global Divide

In the field of computer vision, image segmentation has historically been split between two powerful but distinct paradigms. The first, MRF Regularization, excels at local properties such as edge alignment and smoothness, typically solved via efficient combinatorial methods like max-flow/min-cut (e.g., GrabCut). The second, Pairwise Clustering (such as Normalized Cut), focuses on global data properties to encourage "balanced" clusters based on feature similarities, often solved through spectral relaxation.

While combining these approaches—pairing global balance with crisp, edge-aligned boundaries—is highly desirable, their optimization techniques have remained fundamentally incompatible. Researchers have traditionally been forced to choose between the two or rely on heuristic hybrids lacking theoretical rigor.

The Problem: Limitations of Current Models

Standard model-fitting methods like GrabCut rely on appearance models (GMMs or Histograms) that can easily over-fit to local data, especially in noisy environments. Conversely, global methods like Normalized Cut (NC) often struggle with precise boundary localization because they lack the local edge-alignment constraints inherent to MRFs.

Comparison of segmentation methods: (a) Initialization, (b) GMM fitting (GrabCut without edges), (c) Normalized Cut in RGB.

As seen in Figure 1, GMM-based fitting (b) may fail to capture the full extent of an object if the color distribution is complex, while Normalized Cut (c) provides a more balanced partition but may not respect the fine details of the object's silhouette.

Methodology: The Kernel Cut Framework

The Kernel Cut framework bridges this gap using bound optimization. The core innovation lies in deriving linear (unary) upper bounds for complex clustering objectives like Average Association (AA) and Normalized Cut (NC). By approximating these high-order terms with a simple linear bound, the clustering objective effectively becomes a "unary term" within a standard MRF energy function.

The theoretical bridge: Unifying (A) Basic K-means, (B) Probabilistic K-means (GMMs), and (C) Kernel K-means (Normalized Cut) through equivalent energy formulations.

This unification, detailed in Figure 5, demonstrates that NC and AA are equivalent to weighted versions of Kernel K-means (kKM). This allows the use of the "kernel trick" to handle high-dimensional features—including color, texture, location, depth, and motion—without explicit embedding. Optimization is then performed using powerful move-making algorithms like $\alpha$-expansion, which iteratively compute new linear bounds and use standard graph cuts to minimize the total energy.

Key Insights and Results

  • Linearity and Concavity: The realization that complex clustering objectives have concave relaxations is pivotal. Their first-order Taylor expansion provides a valid global upper bound, transforming a difficult global problem into a sequence of manageable local ones.
  • Feature Fusion: The kernel-based nature of the model makes it exceptionally strong for multi-modal segmentation (e.g., RGBD or motion-based). It treats spatial location or depth as additional dimensions, allowing the NC term to enforce spatial compactness while the MRF term ensures edge alignment.
  • Performance: Evaluated on datasets like BSDS500, NYUv2, and KITTI, Kernel Cut significantly outperformed standard spectral clustering. On BSDS500, it achieved a Probabilistic Rand Index (PRI) of 0.78, compared to 0.76 for standard spectral methods, while maintaining much better boundary adherence.

Conclusion

Kernel Cut provides a mathematically rigorous way to combine the strengths of spectral clustering and MRF regularization. By treating global clustering as a sequence of unary terms via bound optimization, it enables the use of efficient discrete solvers for complex, joint energy functions, paving the way for more robust and accurate automated image analysis.

Summary updated

Abstract

We propose a new segmentation model combining common regularization energies, e.g. Markov Random Field (MRF) potentials, and standard pairwise clustering criteria like Normalized Cut (NC), average association (AA), etc. These clustering and regularization models are widely used in machine learning and computer vision, but they were not combined before due to significant differences in the corresponding optimization, e.g. spectral relaxation and combinatorial max-flow techniques. On the one hand, we show that many common applications using MRF segmentation energies can benefit from a high-order NC term, e.g. enforcing balanced clustering of arbitrary high-dimensional image features combining color, texture, location, depth, motion, etc. On the other hand, standard clustering applications can benefit from an inclusion of common pairwise or higher-order MRF constraints, e.g. edge alignment, bin-consistency, label cost, etc. To address joint energies like NC+MRF, we propose efficient Kernel Cut algorithms based on bound optimization. While focusing on graph cut and move-making techniques, our new unary (linear) kernel and spectral bound formulations for common pairwise clustering criteria allow to integrate them with any regularization functionals with existing discrete or continuous solvers.
BibTeX
@inproceedings{tang2015secrets,
  author = {Meng Tang and Ismail Ben Ayed and Dmitrii Marin and Yuri Boykov},
  title = {{Secrets of GrabCut and Kernel K-means}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2015},
  url = {https://openreview.net/forum?id=Sk-xgZMObB},
}
Figure