Online Clustered Codebook

Abstract

Vector Quantisation (VQ) is experiencing a comeback in machine learning, where it is increasingly used in representation learning. However, optimizing the codevectors in existing VQ-VAE is not entirely trivial. A problem is codebook collapse, where only a small subset of codevectors receive gradients useful for their optimization, whereas a majority of them simply "dies off" and is never updated or used. This limits the effectiveness of VQ for learning larger codebooks in complex computer vision tasks that require high-capacity representations. In this paper, we present a simple alternative method for online codebook learning, Clustering VQ-VAE (CVQ-VAE). Our approach selects encoded features as anchors to update the "dead" codevectors, while optimizing the codebooks which are alive via the original loss. This strategy brings unused codevectors closer in distribution to the encoded features, increasing the likelihood of being chosen and optimized. We extensively validate the generalization capability of our quantizer on various datasets, tasks (e.g., reconstruction and generation), and architectures (e.g., VQ-VAE, VQGAN, LDM). CVQ-VAE can be easily integrated into the existing models with just a few lines of code.

Cite

Text

Zheng and Vedaldi. "Online Clustered Codebook." International Conference on Computer Vision, 2023. doi:10.1109/ICCV51070.2023.02084

Markdown

[Zheng and Vedaldi. "Online Clustered Codebook." International Conference on Computer Vision, 2023.](https://mlanthology.org/iccv/2023/zheng2023iccv-online/) doi:10.1109/ICCV51070.2023.02084

BibTeX

@inproceedings{zheng2023iccv-online,
  title     = {{Online Clustered Codebook}},
  author    = {Zheng, Chuanxia and Vedaldi, Andrea},
  booktitle = {International Conference on Computer Vision},
  year      = {2023},
  pages     = {22798-22807},
  doi       = {10.1109/ICCV51070.2023.02084},
  url       = {https://mlanthology.org/iccv/2023/zheng2023iccv-online/}
}