Introduction
Gaussian Mean-Shift (GMS) is a powerful non-parametric clustering algorithm widely used in image segmentation for its ability to find modes in a probability density function without prior assumptions about the number of clusters. However, its computational complexity of $O(kN^2)$—where $N$ is the number of pixels and $k$ is the number of iterations—presents a significant bottleneck. This paper evaluates four distinct acceleration strategies to mitigate this cost, identifying spatial discretisation as a highly effective method for practical applications.
Acceleration Strategies
The study compares four primary methods against the exact GMS "gold standard":
1. Spatial Discretisation (ms1)
This method exploits the spatial redundancy of pixel trajectories. The spatial domain is divided into a sub-pixel grid. When a pixel's trajectory enters a grid cell previously visited by another path, the computation for that pixel stops, and it is assigned to the same mode as the previous path. This "caching" mechanism significantly reduces redundant calculations.
2. Spatial Neighbourhood (ms2)
Instead of summing over all $N$ pixels to calculate the density gradient, this approach restricts the calculation to a local spatial window of radius $r$. While faster, it risks failing to converge to global modes if the radius is too small.
3. Sparse EM (ms3)
Based on the principle that only nearby components contribute significantly to the posterior probability, this method updates only a "plausible set" of components in most iterations, performing full updates only occasionally.
4. EM-Newton (ms4)
GMS can be viewed as an Expectation-Maximization (EM) algorithm, which typically exhibits slow linear convergence near modes. The EM-Newton approach uses standard EM steps initially for robustness and switches to Newton’s method for quadratic convergence once the iterate is sufficiently close to a mode.
Experimental Evaluation and Results
The strategies were tested on various images, with a focus on the $100 \times 100$ "cameraman" benchmark. Results indicate that the choice of bandwidth ($\sigma$) significantly impacts both the number of iterations required and the resulting cluster count.
Key Findings
- Efficiency:
ms1(Spatial Discretisation) emerged as the superior strategy, providing speedups of 10x to 100x. It reduces the average iterations per pixel from approximately 100 to just 2–4. - Accuracy:
ms1maintains high fidelity, with clustering errors typically below 3%.ms3(Sparse EM) offers the highest accuracy (near zero error) but with more modest speed gains. - Convergence:
ms4(EM-Newton) provides a 1.5x to 6x speedup by accelerating the final stages of convergence, though it does not address the initial trajectory redundancy as effectively asms1.
Conclusion
The success of spatial discretisation is rooted in the "Manifold Advantage": image data points often lie near a 2D manifold in feature space, making spatially close paths highly likely to converge to the same mode. By effectively caching these paths, ms1 overcomes the quadratic complexity of traditional GMS, making high-quality image segmentation feasible for larger datasets. Future work may explore combining these orthogonal strategies, such as using ms1 for path reduction and ms4 for final mode refinement.
Summary updated