SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.15139 · ICCV · 2023

Online Clustered Codebook

Andrea Vedaldi, Chuanxia Zheng

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 2 have no contract verdict; 5 failures of our instrument; 1 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2307.15139.json · badge: /api/ran/2307.15139.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
lyndonzheng/cvq-vae canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
lyndonzheng/CVQ-VAE community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
FeaturePool Ran
ran on a synthesized input · constructed an object; no result was computed
lyndonzheng/CVQ-VAE/quantise.py
code served (permissive licence) · get_code("16bbb393dd49558f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, FeaturePool: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "pool_size": 8,
    "dim": 4,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FeaturePool — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a FeaturePool output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
VectorQuantiser Ran
ran on a synthesized input · constructed an object; no result was computed
lyndonzheng/CVQ-VAE/quantise.py
code served (permissive licence) · get_code("421dff121c22ecee")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, VectorQuantiser: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'num_embed': 8,
    'embed_dim': 4,
    'beta': 0.25,
    'distance': 'cos',
    'anchor': 'probrandom',
    'first_batch': False,
    'contras_loss': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type VectorQuantiser — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VectorQuantiser output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calculate_frechet_distance Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
lyndonzheng/cvq-vae/fid_score.py
pointer only (licence: MIT); the stored copy get_code serves, from shpda/text-to-image-gen-model-acgan, is pointer only (licence: NONE) · get_code("4cee7c1861294d59")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shpda/text-to-image-gen-model-acgan, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

imread Ran
ran, honoured the contract we drafted
lyndonzheng/cvq-vae/fid_score.py
code served (permissive licence) · get_code("e501824778deaaba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 3, dtype family int, shape (229, 229, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from PIL import Image
import tempfile
import os

# Create a temporary RGB image file for testing
temp_dir = tempfile.mkdtemp()
temp_image_path = os.path.join(temp_dir, "test_image.png")

# Create a simple RGB image (100x100) and save it
img = Image.new('RGB', (100, 100), color=(73, 109, 137))
img.save(temp_image_path)

ARGS = {
    'filename': temp_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family int, shape (229, 229, 3) — shape (229, 229, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_image_file Ran
ran, violated the contract we drafted
lyndonzheng/cvq-vae/image_folder.py
pointer only (licence: MIT); the stored copy get_code serves, from sgoldyaev/DeepFashion.ADGAN, is pointer only (licence: NONE) · get_code("ab4109634b75ef8b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from sgoldyaev/DeepFashion.ADGAN, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

make_dataset Ran
ran; our contract draft was wrong, not the code
lyndonzheng/cvq-vae/image_folder.py
code served (permissive licence) · get_code("2ada525b8065407b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil

# Create a temporary directory with some test images
temp_dir = tempfile.mkdtemp()

# Create some dummy image files
test_images = ['image1.jpg', 'image2.png', 'image3.bmp']
for img_name in test_images:
    img_path = os.path.join(temp_dir, img_name)
    with open(img_path, 'w') as f:
        f.write('dummy image data')

# Create a temporary txt file with image paths
temp_txt = tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False)
for img_name in test_images:
    img_path = os.path.join(temp_dir, img_name)
    temp_txt.write(img_path + '\n')
temp_txt.close()

# Test with directory path
ARGS = {
    'path_files': temp_dir
}

# Alternatively, to test with txt file:
# ARGS = {
#     'path_files': temp_txt.name
# }
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
make_dataset_txt Ran
ran; our contract draft was wrong, not the code
lyndonzheng/cvq-vae/image_folder.py
code served (permissive licence) · get_code("f2c64c9aef6136db")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import torch
import numpy as np

# Create a temporary directory and files for testing
temp_dir = tempfile.mkdtemp()

# Create some dummy image files
image_paths = []
for i in range(3):
    img_path = os.path.join(temp_dir, f"image_{i}.jpg")
    # Create empty files to simulate images
    open(img_path, 'a').close()
    image_paths.append(img_path)

# Create a text file containing image paths
txt_file = os.path.join(temp_dir, "image_list.txt")
with open(txt_file, 'w') as f:
    for path in image_paths:
        f.write(path + '\n')
    # Also add a non-existent path and a non-image file to test filtering
    f.write(os.path.join(temp_dir, "nonexistent.jpg") + '\n')
    f.write(os.path.join(temp_dir, "notanimage.txt") + '\n')

ARGS = {
    'files': txt_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
tensor2array Ran
ran; our contract draft was wrong, not the code
lyndonzheng/cvq-vae/util.py
code served (permissive licence) · get_code("0d6fa4426be1d4f0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (24,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create test tensors with different dimensions
# 3D tensor case
tensor_3d = torch.randn(2, 3, 4)

# 4D tensor case (will use [0] indexing)
tensor_4d = torch.randn(2, 3, 4, 5)

ARGS = {
    "value_tensor": tensor_3d
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (24,) — shape (24,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
tensor2im Ran
ran; our contract draft was wrong, not the code
lyndonzheng/cvq-vae/util.py
code served (permissive licence) · get_code("ac25d7d08e59e05c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 3, dtype family int, shape (4, 5, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Test case 1: 4D tensor (batch of images)
# Shape: (batch=1, channels=3, height=4, width=5)
input_tensor_4d = torch.randn(1, 3, 4, 5)

# Test case 2: 3D tensor (single image)
# Shape: (channels=3, height=4, width=5)
input_tensor_3d = torch.randn(3, 4, 5)

# Test case 3: 3D tensor with single channel
# Shape: (channels=1, height=4, width=5)
input_tensor_1ch = torch.randn(1, 4, 5)

# Test case 4: numpy array (already converted)
input_numpy = np.random.randint(0, 256, (4, 5, 3), dtype=np.uint8)

ARGS = {
    "input_image": input_tensor_4d,
    "imtype": np.uint8
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family int, shape (4, 5, 3) — shape (4, 5, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_activations Not yet run
unverified (harvested, no recorded run)
lyndonzheng/cvq-vae/fid_score.py
code served (permissive licence) · get_code("3c77e5bea8e44a31")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 2 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
calculate_frechet_distance 74 other papers
42 dated earlier, 2 the same month, 29 later, 1 same year, order not determinable
1610.09585 (2016-10)
Conditional Image Synthesis With Auxiliary Classifier GANs
1706.08500 (2017-06)
GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium
1807.11458 (2018-07)
To learn image super-resolution, use a GAN to learn how to do image degradation first
and 71 more not named here
is_image_file 62 other papers
37 dated earlier, 25 later
1609.04802 (2016-09)
Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network
1703.07511 (2017-03)
Deep Photo Style Transfer
1710.10916 (2017-10)
StackGAN++: Realistic Image Synthesis with Stacked Generative Adversarial Networks
and 59 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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 optimisation, 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 optimising 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 quantiser 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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2307.15139")
get_code_for_paper("2307.15139")
have("2307.15139")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2307.15139.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2307.15139.svg)](https://syntology.ai/paper/2307.15139)

Connect an agent — have() is free.