Clustering Plotted Data by Image Segmentation

Tarek Naous, Srinjay Sarkar, Abubakar Abid, James Zou

Introduction

Traditional clustering algorithms, such as K-Means, Gaussian Mixture Models (GMM), and DBSCAN, treat data as points in a metric space. While effective for many tasks, these methods face two primary challenges: computational scalability and alignment with human visual intuition. As datasets grow to millions of samples, distance-based calculations often scale poorly ($O(N^2)$ or $O(N \log N)$). Furthermore, these algorithms frequently struggle with non-convex shapes—like concentric circles or interlocking moons—that a human observer can identify instantly.

"Visual Clustering" proposes a paradigm shift: reimagining clustering as a computer vision task. By plotting data onto a 2D grid and employing a U-Net image segmentation model, this approach achieves high performance on complex shapes while maintaining linear scalability for massive datasets.

The Visual Clustering Pipeline

The methodology transforms the clustering problem into a sequence of image processing steps. The core pipeline consists of four stages:

  1. Plotting: High-dimensional data is reduced to two dimensions (typically via PCA) and mapped onto a $256 \times 256$ binary matrix.
  2. Binary Segmentation: This "image" is processed by a pre-trained U-Net, which predicts a binary mask identifying potential cluster regions.
  3. Instance Separation: To distinguish adjacent clusters, the system applies Connected Component Analysis and a Watershed transformation to the mask, generating a label map.
  4. Cluster Assignment: Original data points are mapped back onto the label map; each point inherits the cluster ID of its corresponding pixel.
The four-step Visual Clustering pipeline: plotting, U-Net segmentation, instance separation, and final cluster assignment.

Optional pre-processing steps, such as median filtering for denoising, and post-processing steps, like max filtering to expand cluster boundaries, can be used to refine results for noisy or sparse datasets.

Performance and Visual Intuition

A key advantage of Visual Clustering is its ability to handle complex geometries that baffle traditional distance-based methods. On synthetic benchmarks like nested circles and moons, the model achieved an Adjusted Mutual Information (AMI) score of 0.99, matching the performance of DBSCAN and significantly outperforming K-Means.

Comparison of Visual Clustering against traditional algorithms on standard synthetic benchmarks, highlighting its ability to capture non-convex shapes.

Because the model is trained on visual representations, it naturally aligns with human perception. Unlike K-Means, which requires a predefined number of clusters ($K$), or DBSCAN, which requires a distance threshold ($\epsilon$), the core U-Net approach is largely hyperparameter-free by default.

Scalability and Real-World Application

By moving the computational burden to a pre-trained neural network, the complexity of the core algorithm becomes independent of the number of data points. The only stages that scale with $N$ are the initial plotting and final assignment.

In empirical tests, Visual Clustering processed a dataset of 2 million samples in approximately 14 seconds. This performance is comparable to GMM and faster than K-Means (~19s) and DBSCAN (~53s). The authors demonstrated the method's utility on real-world data, including urban accident records and household power consumption datasets, showing that it maintains linear scalability where $O(N^2)$ algorithms become impractical.

Limitations and Future Directions

Despite its strengths, the method is constrained by the quality of the 2D projection. If PCA or other dimensionality reduction techniques fail to preserve cluster structures, the visual segmentation will be compromised. Additionally, the current model can struggle with clusters that are physically connected in the 2D plot. Future work aims to incorporate more flexible segmentation architectures to better handle these overlapping instances and improve the handling of sparse, low-density data points.

Summary updated

BibTeX
@inproceedings{naous2021clustering,
  author = {Tarek Naous and Srinjay Sarkar and Abubakar Abid and James Zou},
  title = {{Clustering Plotted Data by Image Segmentation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr52688.2022.02084},
}
Figure