GridShift: A Faster Mode-seeking Algorithm for Image Segmentation and Object Tracking

Rammohan Mallipeddi, Abhishek Kumar, Swagatam Das, Oladayo Solomon AjaniOpenReview 2022

Abstract

In machine learning and computer vision, mean shift (MS) qualifies as one of the most popular mode-seeking algorithms used for clustering and image segmentation. It iteratively moves each data point to the weighted mean of its neighborhood data points. The computational cost required to find the neighbors of each data point is quadratic to the number of data points. Consequently, the vanilla MS appears to be very slow for large-scale datasets. To address this issue, we propose a mode-seeking algorithm called GridShift, with significant speedup and principally based on MS. To accelerate, GridShift employs a grid-based approach for neighbor search, which is linear in the number of data points. In addition, GridShift moves the active grid cells (grid cells associated with at least one data point) in place of data points towards the higher density, a step that provides more speedup. The runtime of GridShift is linear in the number of active grid cells and exponential in the number of features. Therefore, it is ideal for large-scale low dimensional applications such as object tracking and image segmentation. Through extensive experiments, we showcase the superior performance of GridShift compared to other MS-based as well as state-of-the-art algorithms in terms of accuracy and runtime on benchmark datasets for image segmentation. Finally, we provide a new object-tracking algorithm based on GridShift and show promising results for object tracking compared to CamShift and meanshift++.

Introduction

Mean Shift (MS) is a cornerstone of non-parametric clustering in computer vision, valued for its ability to find modes without prior knowledge of the number of clusters or data distribution. However, its $O(n^2)$ complexity makes it impractical for high-resolution images or real-time applications. While variants like MeanShift++ have introduced grid-based partitioning, they often fall short in performance for large-scale tasks. GridShift (GS) addresses these bottlenecks by shifting grid cell centroids rather than individual points, achieving massive speedups while maintaining high accuracy.

Methodology: The GridShift Algorithm

GridShift reimagines mode-seeking through several key innovations:

  1. Active Grid Shifting: The data space is partitioned into grid cells. The algorithm only tracks "active" cells—those containing at least one data point—and moves the centroids of these cells toward higher-density regions. This acts as a highly efficient proxy for moving thousands of individual points.
  2. Sequential Updates: Unlike parallel methods that use "stale" neighbor positions, GS updates centroids sequentially. As soon as a cell's centroid is updated, its new position is immediately utilized for the next cell's shift calculation, leading to faster and more stable convergence.
  3. Linear Complexity: The runtime is linear relative to the number of active grid cells ($m$), making it an optimized specialist for low-dimensional feature spaces such as RGB (color) or RGBXY (spatial-color).
The GridShift algorithm iteratively moves centroids of active grid cells toward higher density regions until convergence.

Experimental Evaluation

The performance of GridShift was evaluated across clustering, image segmentation (BSDS500), and object tracking (OTB100) benchmarks.

Image Segmentation

On the BSDS500 dataset, GridShift demonstrated a remarkable balance of speed and quality. It achieved higher Adjusted Rand Index (ARI) and Fowlkes-Mallows (FM) scores than most competitors. Quantitatively, GridShift was 40x faster than MeanShift++, 500x faster than Quickshift, and up to 40,000x faster than vanilla Mean Shift.

Visual comparison of segmentation algorithms. GridShift (second column) produces high-quality segments with significantly lower runtimes than MeanShift++, Felzenszwalb, SLIC, and Quickshift.

Object Tracking

For object tracking, the GS-based tracker (USOT-GS) incorporated an adaptive tracking window to handle scale changes and target loss. In the OTB100 benchmark, it outperformed several supervised and unsupervised trackers, particularly in "distractor" environments where background colors mimic the target—a scenario where the classic CamShift often fails.

Conclusion

GridShift represents a significant leap in mode-seeking efficiency for low-dimensional data. By embracing the trade-offs of dimensionality and leveraging grid-based proxies, it enables real-time performance for complex computer vision tasks. Future work will focus on automating hyperparameter tuning and integrating object detection models to eliminate the need for manual initialization in tracking applications.

Summary updated

BibTeX
@misc{mallipeddi2022gridshift,
  author = {Rammohan Mallipeddi and Abhishek Kumar and Swagatam Das and Oladayo Solomon Ajani},
  title = {{GridShift: A Faster Mode-seeking Algorithm for Image Segmentation and Object Tracking}},
  year = {2022},
  url = {https://openreview.net/forum?id=V6V6KF2elT},
  howpublished = {OpenReview},
}
Figure