Introduction
In computer vision, representation learning aims to teach models to understand visual content without explicit semantic labels. A prominent approach is cluster discrimination, where a model groups similar images into clusters and learns to distinguish between these groups. While effective, traditional clustering methods like K-Means are typically "batch" processes, requiring access to the entire dataset. This creates a significant bottleneck in deep learning workflows that rely on mini-batch processing.
To address this, we present CoKe (Online Constrained K-Means), a framework that enables fast, memory-efficient, and theoretically grounded online clustering for self-supervised learning.
The Challenge of Online Clustering
Unsupervised learning often utilizes pretext tasks such as instance discrimination or cluster discrimination. Cluster discrimination (e.g., SwAV, DeepCluster) is powerful but prone to collapsing, where the model assigns all images to a single cluster to minimize loss. To prevent this, previous methods enforced "balanced clustering" using iterative solvers like Sinkhorn-Knopp. However, these solvers are computationally expensive and difficult to scale in a truly online, streaming fashion.
The CoKe Framework
CoKe introduces a novel approach to online clustering by replacing strict balance with a minimum size constraint and decoupling the clustering phase from the discrimination phase.
Decoupled Learning and Online Assignment
A key innovation in CoKe is the decoupled learning mechanism. As shown in Figure 1, the model at epoch $t$ utilizes pseudo-labels and cluster centers calculated during the previous epoch ($t-1$). This "look-back" strategy functions as a natural memory bank, avoiding the high memory overhead of storing large feature banks.
Furthermore, CoKe employs Online Constrained Assignment. Instead of forcing all clusters to be of equal size, it enforces only a minimum size. By using dual variables to penalize the neglect of specific clusters, the model can adapt to the naturally imbalanced distributions found in real-world data. The authors provide theoretical proofs demonstrating that this online method effectively approaches the global optimum of the clustering objective.
Key Insights and Empirical Analysis
Flexibility in Cluster Constraints
One of the core findings is that constrained clustering is superior to perfectly balanced clustering. By setting a lower bound on cluster size rather than a strict equality, the model can accommodate "popular" visual categories while ensuring no cluster is entirely ignored.
As seen in the ablation study (Figure 3), reducing the constraint ratio $\gamma'$ from 1 (strict balance) to 0.4 improves accuracy from 63.1% to 64.5%. This flexibility allows the model to better capture the inherent structure of the dataset.
Efficiency and Single-View Learning
CoKe is remarkably efficient. While many self-supervised methods require multiple augmented views of an image to learn effectively, CoKe achieves 71.4% accuracy on ImageNet using only a single view per image, outperforming multi-view methods like MoCo-v2. In terms of speed, CoKe processes an ImageNet epoch in approximately 11 minutes, nearly twice as fast as SwAV (21 minutes) on identical hardware.
Results
CoKe demonstrates state-of-the-art performance across various benchmarks:
- ImageNet-1K: Utilizing the "multi-crop" technique, CoKe achieves 76.4% top-1 accuracy on linear evaluation, matching the performance of fully supervised ResNet-50 (76.5%).
- Transfer Learning: In downstream tasks like object detection on PASCAL VOC, CoKe achieves an $AP_{50}$ of 83.2, surpassing both supervised pre-training (81.3) and MoCo-v2 (83.0).
- Robustness: The method maintains consistent performance across different batch sizes (256 to 1024), highlighting its stability.
Conclusion
CoKe represents a significant advancement in online clustering for self-supervised learning. By moving from rigid balance to flexible constraints and employing a decoupled learning strategy, it offers a high-performance, resource-efficient alternative to existing methods. Future research may explore the application of CoKe to Vision Transformer (ViT) architectures and further optimize the selection of the cluster count $K$.
Summary updated