SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.11568 · 2021

Cluster Contrast for Unsupervised Person Re-Identification

arXiv · PDF · Open in the Atlas

Code that ran

10 of 14 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 7 failures of our instrument; 4 no recorded run), measured 2026-11-22; 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/2103.11568.json · badge: /api/ran/2103.11568.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
alibaba/cluster-contrast canonical (classifier label)
classifier basis: census
8 ran · 4 no recorded run
alibaba/cluster-contrast-reid community (classifier label)
classifier basis: plan_row
2 ran · 0 no recorded run
FunctionStatusWhere it lives
cm Ran
ran; our contract draft was wrong, not the code
alibaba/cluster-contrast/clustercontrast/models/cm.py
code served (permissive licence) · get_code("10ba7332fd4a54eb")
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 Tensor, ndim 2, dtype family float, shape (2, 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
from torch import nn, autograd

torch.manual_seed(0)

# Parameters for the cm function:
# - inputs: a tensor that will be matrix-multiplied with features.t()
# - indexes: target indices for updating features
# - features: a feature matrix that gets updated in backward
# - momentum: scalar momentum value

# Create small tensors with distinct dimensions
batch_size = 2
feature_dim = 4
num_features = 3

inputs = torch.randn(batch_size, feature_dim, requires_grad=True)
indexes = torch.tensor([0, 2], dtype=torch.long)
features = torch.randn(num_features, feature_dim, requires_grad=False)

# Normalize features as expected by the backward pass
features = features / features.norm(dim=1, keepdim=True)

momentum = 0.5

ARGS = {
    "inputs": inputs,
    "indexes": indexes,
    "features": features,
    "momentum": momentum,
}
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 Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 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
cm_hard Ran
ran; our contract draft was wrong, not the code
alibaba/cluster-contrast/clustercontrast/models/cm.py
pointer only (licence: MIT); the stored copy get_code serves, from lhf12278/FCM-ReID, is pointer only (licence: MIT) · get_code("f2fd62d39c9658d0")
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 lhf12278/FCM-ReID, and MIT, as GitHub detects it on that repository, is in the permissive set, but a licence decision keeps the body a pointer: its licence file names an outside party, so it may cover vendored code rather than the repository owner's files (recorded as pointer:licence_names_third_party_corporation). 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.

conv3x3 Ran
ran; our contract draft was wrong, not the code
alibaba/cluster-contrast/clustercontrast/models/resnet_ibn_a.py
pointer only (licence: MIT); the stored copy get_code serves, from lixiaotong97/DSU, is pointer only (licence: NONE) · get_code("fac5364e2f53c6db")
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 lixiaotong97/DSU, 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.

intdict2ndarray Ran
ran, honoured the contract we drafted
alibaba/cluster-contrast-reid/clustercontrast/utils/infomap_cluster.py
pointer only (licence: MIT); the stored copy get_code serves, from xjtuyw/pnp, is pointer only (licence: NONE) · get_code("aa57815e101e6fa5")
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 xjtuyw/pnp, 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.

l2norm Ran
ran, violated the contract we drafted
alibaba/cluster-contrast/clustercontrast/utils/infomap_cluster.py
code served (permissive licence) · get_code("34b0da41b1dd21f0")
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 2, dtype family float, shape (2, 4) 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 small 2D array with shape (2, 4)
# This represents a batch of 2 vectors, each with 4 dimensions
vec = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=np.float32)

ARGS = {
    "vec": vec
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 (2, 4) — shape (2, 4) 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
pairwise_distance Ran
ran, honoured the contract we drafted
alibaba/cluster-contrast/clustercontrast/evaluators.py
code served (permissive licence) · get_code("b6d5887f94b1db25")
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 Tensor, ndim 2, dtype family float, shape (2, 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 torch
import numpy as np

torch.manual_seed(0)

# Case 1: query=None and gallery=None
# The function expects features to be a dict where values() returns tensors
# that can be concatenated. n = len(features), and each tensor should be viewable as a vector.
features_dict = {
    'feat_0': torch.randn(4),  # 4-dim feature vector
    'feat_1': torch.randn(4),  # 4-dim feature vector
}

# Case 2: query and gallery are provided
# They are lists of tuples where each tuple is (feature_id, ..., ...)
# The function accesses features[f] for f being the first element of each tuple
query_list = [
    ('feat_0', 'label_0', 'cam_0'),
    ('feat_1', 'label_1', 'cam_1'),
]

gallery_list = [
    ('feat_0', 'label_0', 'cam_0'),
    ('feat_1', 'label_1', 'cam_1'),
]

# For the case with query and gallery, we need features dict with the feature ids
features_dict_case2 = {
    'feat_0': torch.randn(4),
    'feat_1': torch.randn(4),
}

# Test both cases by creating two different ARGS configurations
# We'll go with case 1 (query=None, gallery=None) as the primary setup
ARGS = {
    'features': features_dict,
    'query': None,
    'gallery': None,
}
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 Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 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
process_dir Ran
ran; our contract draft was wrong, not the code
alibaba/cluster-contrast/clustercontrast/datasets/dukemtmcreid.py
code served (permissive licence) · get_code("7e822f939fbe184f")
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 list, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 tempfile
import os

# Create a temporary directory with mock image files matching the expected pattern
temp_dir = tempfile.mkdtemp()

# Create some mock image files with names matching pattern: ([-\d]+)_c(\d)
mock_files = [
    "0001_c1.jpg",
    "0001_c2.jpg",
    "0002_c1.jpg",
    "0002_c3.jpg",
    "0003_c2.jpg",
    "-1_c1.jpg",  # This should be filtered out (pid == -1)
]

for fname in mock_files:
    fpath = os.path.join(temp_dir, fname)
    with open(fpath, 'w') as f:
        f.write("mock")

ARGS = {
    "dir_path": temp_dir,
    "relabel": False,
}
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 list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
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
read_meta Ran
ran; our contract draft was wrong, not the code
alibaba/cluster-contrast-reid/clustercontrast/utils/infomap_cluster.py
pointer only (licence: MIT); the stored copy get_code serves, from xiaoxiong74/face-cluster-by-infomap, is pointer only (licence: NONE) · get_code("b91ea1291400178a")
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 xiaoxiong74/face-cluster-by-infomap, 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.

resnet101_ibn_a Ran
ran; our contract draft was wrong, not the code
alibaba/cluster-contrast/clustercontrast/models/resnet_ibn_a.py
code served (permissive licence) · get_code("c7f5d45660e6ec13")
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 ResNet. 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
import math

torch.manual_seed(0)

# Define ARGS dictionary with parameters for resnet101_ibn_a
ARGS = {
    'pretrained': False,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
resnet50_ibn_a Ran
ran; our contract draft was wrong, not the code
alibaba/cluster-contrast/clustercontrast/models/resnet_ibn_a.py
code served (permissive licence) · get_code("93cbdbc352d644d9")
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 ResNet. 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 = {
    'pretrained': False,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
build_pooling_layer Not yet run
unverified (harvested, no recorded run)
alibaba/cluster-contrast/clustercontrast/models/pooling.py
code served (permissive licence) · get_code("5c5d2f6f3c01ba6c")
How it ran

no invocation recorded.

extract_cnn_feature Not yet run
unverified (harvested, no recorded run)
alibaba/cluster-contrast/clustercontrast/evaluators.py
code served (permissive licence) · get_code("fbb5efeed7ebfd09")
How it ran

no invocation recorded.

extract_features Not yet run
unverified (harvested, no recorded run)
alibaba/cluster-contrast/clustercontrast/evaluators.py
pointer only (licence: MIT); the stored copy get_code serves, from whbdmu/FOUS, is pointer only (licence: NONE) · get_code("962810c012a60817")
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 whbdmu/FOUS, 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. No invocation recorded.

label_generator_kmeans Not yet run
unverified (harvested, no recorded run)
alibaba/cluster-contrast/clustercontrast/models/kmeans.py
code served (permissive licence) · get_code("4560dc753fea5981")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 14 are also present in other papers whose code we hold (14 with at least one paper dated earlier, 1 the same month, 14 later) and 0 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
conv3x3 686 other papers
274 dated earlier, 10 the same month, 396 later, 6 same year, order not determinable · 31 only as an assembly brick
1406.2661 (2014-06)
Generative Adversarial Networks
1409.0575 (2014-09)
ImageNet Large Scale Visual Recognition Challenge
1412.6572 (2014-12)
Explaining and Harnessing Adversarial Examples
and 683 more not named here
pairwise_distance 7 other papers
1 dated earlier, 6 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
136740192 (2022 (year only))
PASS: Part-Aware Self-Supervised Pre-Training for Person Re-Identification
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
and 4 more not named here
cm 6 other papers
1 dated earlier, 5 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
136740192 (2022 (year only))
PASS: Part-Aware Self-Supervised Pre-Training for Person Re-Identification
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
and 3 more not named here
extract_cnn_feature 6 other papers
1 dated earlier, 5 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
aaai_19970 (2022 (year only))
SECRET: Self-Consistent Pseudo Label Refinement for Unsupervised Domain Adaptive Person Re-identification
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
and 3 more not named here
label_generator_kmeans 6 other papers
1 dated earlier, 5 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
136740192 (2022 (year only))
PASS: Part-Aware Self-Supervised Pre-Training for Person Re-Identification
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
and 3 more not named here
build_pooling_layer 5 other papers
1 dated earlier, 4 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
136740192 (2022 (year only))
PASS: Part-Aware Self-Supervised Pre-Training for Person Re-Identification
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
and 2 more not named here
resnet101_ibn_a 5 other papers
1 dated earlier, 4 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
136740192 (2022 (year only))
PASS: Part-Aware Self-Supervised Pre-Training for Person Re-Identification
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
and 2 more not named here
resnet50_ibn_a 5 other papers
1 dated earlier, 4 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
136740192 (2022 (year only))
PASS: Part-Aware Self-Supervised Pre-Training for Person Re-Identification
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
and 2 more not named here
extract_features 4 other papers
1 dated earlier, 3 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
and 1 more not named here
cm_hard 3 other papers
1 dated earlier, 2 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
136740192 (2022 (year only))
PASS: Part-Aware Self-Supervised Pre-Training for Person Re-Identification
aaai_28092 (2024 (year only))
Catalyst for Clustering-Based Unsupervised Object Re-identification: Feature Calibration
intdict2ndarray 3 other papers
2 dated earlier, 1 later
1904.02749 (2019-04)
Learning to Cluster Faces on an Affinity Graph
2004.00445 (2020-04)
Learning to Cluster Faces via Confidence and Connectivity Estimation
2404.08995 (2024-04)
Beyond Known Clusters: Probe New Prototypes for Efficient Generalized Class Discovery
l2norm 3 other papers
2 dated earlier, 1 later
1904.02749 (2019-04)
Learning to Cluster Faces on an Affinity Graph
2004.00445 (2020-04)
Learning to Cluster Faces via Confidence and Connectivity Estimation
2404.08995 (2024-04)
Beyond Known Clusters: Probe New Prototypes for Efficient Generalized Class Discovery
process_dir 3 other papers
1 dated earlier, 2 later
1807.09441 (2018-07)
Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net
2311.10605 (2023-11)
CA-Jaccard: Camera-aware Jaccard Distance for Person Re-identification
read_meta 3 other papers
2 dated earlier, 1 later
1904.02749 (2019-04)
Learning to Cluster Faces on an Affinity Graph
2004.00445 (2020-04)
Learning to Cluster Faces via Confidence and Connectivity Estimation
2404.08995 (2024-04)
Beyond Known Clusters: Probe New Prototypes for Efficient Generalized Class Discovery

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

Repositories linked to this paper

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

Abstract

State-of-the-art unsupervised re-ID methods train the neural networks using a memory-based non-parametric softmax loss. Instance feature vectors stored in memory are assigned pseudo-labels by clustering and updated at instance level. However, the varying cluster sizes leads to inconsistency in the updating progress of each cluster. To solve this problem, we present Cluster Contrast which stores feature vectors and computes contrast loss at the cluster level. Our approach employs a unique cluster representation to describe each cluster, resulting in a cluster-level memory dictionary. In this way, the consistency of clustering can be effectively maintained throughout the pipline and the GPU memory consumption can be significantly reduced. Thus, our method can solve the problem of cluster inconsistency and be applicable to larger data sets. In addition, we adopt different clustering algorithms to demonstrate the robustness and generalization of our framework. The application of Cluster Contrast to a standard unsupervised re-ID pipeline achieves considerable improvements of 9.9%, 8.3%, 12.1% compared to state-of-the-art purely unsupervised re-ID methods and 5.5%, 4.8%, 4.4% mAP compared to the state-of-the-art unsupervised domain adaptation re-ID methods on the Market, Duke, and MSMT17 datasets. Code is available at https://github.com/alibaba/cluster-contrast.

For agents

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

get_harvested_code_for_paper("2103.11568")
get_code_for_paper("2103.11568")
have("2103.11568")

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

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

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

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

Connect an agent — have() is free.