NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

BYOCL: Build Your Own Consistent Latent with Hierarchical Representative Latent Clustering

Jiayue Dai, Yunya Wang, Yihan Fang, Yuetong Chen, Butian XiongarXiv 2024 · DOI

Abstract

The Segment Anything Model (SAM) has revolutionized zero-shot image segmentation, yet it struggles with "semantic inconsistency" when applied to video sequences. Without temporal awareness, SAM often assigns different labels or inconsistent boundaries to the same object across frames. We introduce BYOCL (Build Your Own Consistent Latent), a training-free, plug-and-play framework that achieves temporal consistency through hierarchical clustering of latent features. By organizing features into intra-batch and inter-batch clusters, BYOCL ensures stable segmentation across sequences while significantly reducing processing time compared to existing global optimization methods.

Introduction

Foundation models like SAM are typically designed for single-image inference. When processing video or image sequences, this leads to "flickering" results where temporal logic is absent—a chair identified in one frame may be labeled differently in the next. Existing remedies often require computationally expensive fine-tuning or global feature processing that scales poorly with sequence length. BYOCL addresses these limitations by operating directly on the latent space of a frozen SAM encoder. It leverages the inherent semantic information within latent features to maintain consistency without the need for additional training or massive GPU resources.

Methods: Hierarchical Representative Latent Clustering

BYOCL's core innovation is a two-tiered clustering strategy that "glues" semantic entities across time without retraining the underlying model.

1. Intra-Batch Processing

The sequence is first divided into small temporal batches (e.g., 4 frames). For each batch, high-dimensional features are extracted via the SAM encoder and compressed using Principal Component Analysis (PCA) to a 20-dimensional space. K-means clustering is then applied to identify "prototypes"—cardinal feature vectors that represent distinct semantic regions within the batch.

Latent feature clustering for a single frame, illustrating how semantic regions are grouped in the latent space to form prototypes.

2. Inter-Batch Consistency and Refinement

To maintain global consistency, the prototypes from all batches are clustered together. This hierarchical approach allows the system to link an object identified in an early batch to its appearance in later frames by matching their representative latent vectors. A final refinement stage utilizes a CLIP encoder to generate a similarity matrix, which helps merge redundant masks and eliminate noise, resulting in sharp, semantically consistent outputs.

Key Results

Quantitative evaluations on the DAVIS and MOSE datasets demonstrate BYOCL's effectiveness. On the DAVIS benchmark, BYOCL improved the Mean IoU from 0.5220 to 0.5890 and significantly boosted Recall from 0.5494 to 0.7240. On the MOSE dataset, it achieved a Mean IoU of 0.6552, outperforming the base SAM model.

A comprehensive qualitative overview showing (a, c) input frames, (b, d) the resulting consistent masks, and (e, f, g) the stable latent clusters across the sequence.

Beyond accuracy, BYOCL offers substantial efficiency gains. The hierarchical batch-based clustering allows for an "exponential time reduction" compared to global clustering methods; while standard SAM-based video processing can take several hours, BYOCL typically completes the same tasks in under an hour. Qualitative results confirm that the framework effectively eliminates label swapping and mask fragmentation common in raw SAM outputs.

Conclusion

BYOCL provides a robust, training-free solution for temporal consistency in image sequences. By intelligently clustering latent features, it brings the power of SAM to video-based tasks with high efficiency. While challenges remain in extremely dense multi-object environments, BYOCL provides a scalable path forward for consistent zero-shot segmentation.

Summary updated

BibTeX
@misc{dai2024byocl,
  author = {Jiayue Dai and Yunya Wang and Yihan Fang and Yuetong Chen and Butian Xiong},
  title = {{BYOCL: Build Your Own Consistent Latent with Hierarchical Representative Latent Clustering}},
  year = {2024},
  eprint = {2410.15060},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.15060},
}
Figure