Learn to Cluster Faces via Pairwise Classification

Junfu Liu, Di Qiu, Pengfei Yan, Xiaolin WeiICCV 2021 · DOI

Introduction

As the volume of unlabeled face images grows into the millions, clustering them into distinct identities has become a critical task for large-scale dataset curation and photo management. While Graph Neural Network (GNN) methods have recently set the standard by learning complex inter-image relationships, they suffer from significant drawbacks: high memory consumption and a reliance on manually tuned similarity thresholds.

Comparison of graph-based methods vs. the proposed pairwise classification.

Traditional graph-based approaches often struggle with "out-of-memory" errors on standard hardware when processing millions of nodes. Furthermore, the "threshold trap"—where a similarity threshold optimized for one dataset fails on another—makes these systems brittle in real-world scenarios. This paper introduces a "threshold-free" and "memory-friendly" framework that replaces global graph learning with local pairwise classification.

Methodology

The proposed framework simplifies face clustering into a three-step pipeline designed for efficiency and precision.

The proposed three-step clustering pipeline.

1. Rank-weighted Density

Standard density metrics often fail in the presence of noise. The authors propose a "rank-weighted density" that applies a power function to a sample's closest neighbors. This weighting scheme makes the system more robust to outliers and more effective at identifying true cluster centers by creating a natural "path" from the edges of a cluster toward its center.

2. Pairwise Classification and Contextual Features

Instead of processing the entire graph, the system identifies high-confidence pairs. For each image, it selects the nearest neighbor with a higher rank-weighted density. To improve classification accuracy, the model uses Weighted-Neighbor Features. It concatenates a face's original features with a weighted sum of its $k$-nearest neighbors' features, providing the classifier with essential local context. These enhanced features are fed into a simple Multi-Layer Perceptron (MLP) to determine if the pair belongs to the same identity.

3. Clustering via BFS

Once the classifier predicts which pairs belong to the same identity, the final clusters are generated using a standard Breadth-First Search (BFS) algorithm to link the predicted connections and reconstruct the full identities.

Experimental Results

The method was evaluated on several large-scale benchmarks, including MS-Celeb-1M (up to 5.21M images), IJB-B, and DeepFashion.

  • Accuracy: On the MS-Celeb-1M (584K) subset, the method achieved a Pairwise F-score of 90.67, surpassing both GCN-based methods (87.93) and the previous state-of-the-art DANet (90.6).
  • Efficiency: The pipeline is remarkably fast, processing 584K images in just 1.7 minutes. In contrast, GNN methods required 11.5 minutes, and traditional K-Means took over 11 hours.
  • Memory Footprint: The pairwise approach is highly memory-efficient, requiring only 0.7GB for a batch size of 2048. This allows the system to run on standard consumer hardware or even CPUs, whereas GNN methods often require high-end GPUs with massive VRAM.

Conclusion

By shifting from global graph learning to local pairwise classification guided by rank-weighted density, this framework eliminates the need for manual thresholding and drastically reduces computational overhead. While the initial $k$-nearest neighbor search remains a scaling bottleneck, the overall approach provides a robust, high-performance solution for massive-scale face clustering.

Summary updated

BibTeX
@inproceedings{liu2021learn,
  author = {Junfu Liu and Di Qiu and Pengfei Yan and Xiaolin Wei},
  title = {{Learn to Cluster Faces via Pairwise Classification}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.00382},
}
Figure