SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2008.10312 · NeurIPS · 2020

Self-Supervised Learning for Large-Scale Unsupervised Image Clustering

Evgenii Zheltonozhskii, Chaim Baskin, Alex Bronstein, Avi Mendelson

arXiv · PDF · Open in the Atlas

Code that ran

8 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 4 failures of our instrument; 3 no recorded run), measured 2026-11-21; 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/2008.10312.json · badge: /api/ran/2008.10312.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
Randl/kmeans_selfsuper canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
randl/kmeans_selfsuper canonical (classifier label)
classifier basis: classifier_2025
2 ran · 2 no recorded run
FunctionStatusWhere it lives
crop_center_and_resize Ran
ran on a synthesized input
Randl/kmeans_selfsuper/generate_prediction_tf.py
code served (permissive licence) · get_code("74f9e58e15186552")
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 EagerTensor, ndim 3, dtype family float, shape (8, 8, 2) 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 tensorflow as tf
import numpy as np

# Create a small image tensor
# The function expects img to have shape [height, width, channels]
# Using distinct dimensions: 4 height, 3 width, 2 channels
img = tf.constant(np.random.rand(4, 3, 2).astype(np.float32))

# size parameter - an integer for the output square size
size = 8

# scale parameter - optional, defaults to 0.875
scale = 0.875

ARGS = {
    "img": img,
    "size": size,
    "scale": scale
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (8, 8, 2) — shape (8, 8, 2) 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_best_clusters Ran
ran; our contract draft was wrong, not the code
randl/kmeans_selfsuper/cluster.py
code served (permissive licence) · get_code("63dc243289400452")
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) and returned ndarray, ndim 1, dtype family int, shape (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

# Create a confusion matrix C
# Shape: (num_clusters, num_classes)
# We need a matrix where:
# - rows represent clusters
# - columns represent classes
# - values are counts/frequencies
# Make it 5 clusters x 4 classes for distinctness

np.random.seed(0)
C = np.array([
    [50, 5, 2, 1],      # cluster 0: mostly class 0
    [3, 45, 8, 2],      # cluster 1: mostly class 1
    [2, 3, 40, 5],      # cluster 2: mostly class 2
    [1, 2, 1, 35],      # cluster 3: mostly class 3
    [2, 1, 1, 1],       # cluster 4: low counts (will be zeroed)
], dtype=np.float32)

ARGS = {
    'C': C,
    'k': 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — 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 int, shape (3,) — shape (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_cost_matrix Ran
ran; our contract draft was wrong, not the code
randl/kmeans_selfsuper/cluster.py
code served (permissive licence) · get_code("53437473e6a66a64")
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) and returned ndarray, ndim 2, dtype family float, shape (1000, 5) 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

# Analyze the function:
# - y_pred: iterable of predictions (integers used as indices into C's first dimension)
# - y: iterable of labels (integers used as indices into C's second dimension, max() is called on it)
# - nc: number of classes (first dimension of C)

# Create small test data
y_pred = np.array([5, 10, 3, 7])  # predictions, values < nc
y = np.array([2, 4, 1, 3])  # labels, max will be 4

ARGS = {
    "y_pred": y_pred,
    "y": y,
    "nc": 1000
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (1000, 5) — shape (1000, 5) 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_label Ran
ran on a synthesized input
Randl/kmeans_selfsuper/generate_prediction_tf.py
code served (permissive licence) · get_code("c3d1c7b673f0c808")
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 EagerTensor, ndim 1, dtype family float, shape (0,) 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 os
import pathlib
import numpy as np
import tensorflow as tf

# Mock the imagenet_path and CLASS_NAMES since we can't access real filesystem
imagenet_path = '/mock/imagenet'
train_dir = pathlib.Path(os.path.join(imagenet_path, 'train'))

# Create a mock CLASS_NAMES array with a few class names
CLASS_NAMES = np.array(['class_a', 'class_b', 'class_c', 'class_d'])

def get_label(file_path):
    parts = tf.strings.split(file_path, os.path.sep)
    return parts[-2] == CLASS_NAMES

# Construct valid arguments for get_label
# The function expects file_path to be a string tensor that can be split by os.path.sep
# It should contain a path where the second-to-last component is a class name

# Create a mock file path string
# Format: /some/path/class_name/filename.jpg
mock_file_path = '/mock/imagenet/train/class_a/image001.jpg'

# Convert to TensorFlow string tensor
file_path_tensor = tf.constant(mock_file_path)

ARGS = {
    'file_path': file_path_tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 1, dtype family float, shape (0,) — shape (0,) 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_label_objectnet Ran
ran on a synthesized input
Randl/kmeans_selfsuper/generate_prediction_tf.py
code served (permissive licence) · get_code("25b6cb1de2b6763b")
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 EagerTensor, ndim 1, dtype family float, shape (0,) 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 os
import pathlib
import numpy as np
import tensorflow as tf

# Mock the objectnet directory structure
objectnet_path = '/tmp/objectnet_mock'
os.makedirs(objectnet_path, exist_ok=True)

object_dir = pathlib.Path(os.path.join(objectnet_path, 'images'))
object_dir.mkdir(exist_ok=True)

# Create mock class directories
class_names = ['class_a', 'class_b', 'class_c']
for class_name in class_names:
    (object_dir / class_name).mkdir(exist_ok=True)

CLASS_NAMES_OBJ = np.array([item.name for item in object_dir.glob('*') if item.name != 'LICENSE.txt'])

def get_label_objectnet(file_path):
    parts = tf.strings.split(file_path, os.path.sep)
    return parts[-2] == CLASS_NAMES_OBJ

# Create a valid file path that matches the structure
# The function expects a path like: /tmp/objectnet_mock/images/class_a/image.jpg
file_path = tf.constant('/tmp/objectnet_mock/images/class_a/image.jpg')

ARGS = {
    'file_path': file_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 1, dtype family float, shape (0,) — shape (0,) 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
inception_preproccess Ran
ran; our contract draft was wrong, not the code
Randl/kmeans_selfsuper/torch_utils.py
code served (permissive licence) · get_code("de53820d0a106f94")
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 Compose. 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
from torchvision.transforms import transforms

torch.manual_seed(0)

__imagenet_stats = {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}

def inception_preproccess(input_size, normalize=__imagenet_stats):
    return transforms.Compose([transforms.RandomResizedCrop(input_size), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize(**normalize)])

ARGS = {
    'input_size': 224,
    'normalize': __imagenet_stats
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
scale_crop Ran
ran; our contract draft was wrong, not the code
Randl/kmeans_selfsuper/torch_utils.py
code served (permissive licence) · get_code("8ed66ef9fef840b5")
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 Compose. 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 numpy as np
from torchvision.transforms import transforms

torch.manual_seed(0)

ARGS = {
    'input_size': 224,
    'scale_size': 256,
    'normalize': {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
woof_preproccess Ran
ran on a synthesized input
Randl/kmeans_selfsuper/torch_utils.py
code served (permissive licence) · get_code("f68937364f9c7540")
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 Compose. 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 numpy as np
from torchvision.transforms import transforms

torch.manual_seed(0)

__imagenet_stats = {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}

def woof_preproccess(input_size, normalize=__imagenet_stats):
    return transforms.Compose([transforms.RandomResizedCrop(input_size, scale=(0.35, 1.0)), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize(**normalize)])

ARGS = {
    'input_size': 224,
    'normalize': __imagenet_stats
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
eval Not yet run
unverified (harvested, no recorded run)
randl/kmeans_selfsuper/generate_prediction_pytorch.py
code served (permissive licence) · get_code("96c98a6eaa49160b")
How it ran

no invocation recorded.

eval Not yet run
unverified (harvested, no recorded run)
Randl/kmeans_selfsuper/generate_prediction_pytorch_supervised.py
code served (permissive licence) · get_code("526bad0a33805d03")
How it ran

no invocation recorded.

eval_swav Not yet run
unverified (harvested, no recorded run)
randl/kmeans_selfsuper/generate_prediction_pytorch.py
code served (permissive licence) · get_code("9f240baca01dbd55")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 9 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
inception_preproccess 1 other paper
1 dated earlier
1805.11046 (2018-05)
Scalable Methods for 8-bit Training of Neural Networks
scale_crop 1 other paper
1 dated earlier
1805.11046 (2018-05)
Scalable Methods for 8-bit Training of Neural Networks

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-21.

Repositories linked to this paper

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

Abstract

Unsupervised learning has always been appealing to machine learning researchers and practitioners, allowing them to avoid an expensive and complicated process of labeling the data. However, unsupervised learning of complex data is challenging, and even the best approaches show much weaker performance than their supervised counterparts. Self-supervised deep learning has become a strong instrument for representation learning in computer vision. However, those methods have not been evaluated in a fully unsupervised setting. In this paper, we propose a simple scheme for unsupervised classification based on self-supervised representations. We evaluate the proposed approach with several recent self-supervised methods showing that it achieves competitive results for ImageNet classification (39% accuracy on ImageNet with 1000 clusters and 46% with overclustering). We suggest adding the unsupervised evaluation to a set of standard benchmarks for self-supervised learning. The code is available at https://github.com/ Randl/kmeans_selfsuper.

For agents

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

get_harvested_code_for_paper("2008.10312")
get_code_for_paper("2008.10312")
have("2008.10312")

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

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

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

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

Connect an agent — have() is free.