SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2003.11113 · 2020

PADS: Policy-Adapted Sampling for Visual Similarity Learning

arXiv · PDF · Open in the Atlas

Code that ran

7 of 10 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; 1 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 1 failure of our instrument; 3 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/2003.11113.json · badge: /api/ran/2003.11113.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
Confusezius/CVPR2020_PADS canonical (classifier label)
classifier basis: census
7 ran · 3 no recorded run
FunctionStatusWhere it lives
distance_measure Ran
ran on a synthesized input
Confusezius/CVPR2020_PADS/evaluate.py
code served (permissive licence) · get_code("eb6f6a8712b895c2")
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, ndim 1, 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 numpy as np
from scipy.spatial import distance
from sklearn.preprocessing import normalize

# Set random seed for reproducibility
np.random.seed(0)

# Create small embeddings (5 embeddings, 4 dimensions each)
embeddings = np.random.randn(5, 4).astype(np.float32)

# Create labels (3 classes: 0, 1, 2)
labels = np.array([0, 0, 1, 1, 2], dtype=np.int32)

ARGS = {
    "embeddings": embeddings,
    "labels": labels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
imp, numpy, scipy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
f1_score Ran
ran on a synthesized input
Confusezius/CVPR2020_PADS/auxiliaries.py
code served (permissive licence) · get_code("667f22002df30035")
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 float64, ndim 0, 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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Create small test data
n_samples = 10
n_features = 4
n_clusters = 3

# Generate feature collection (n_samples x n_features)
feature_coll = np.random.randn(n_samples, n_features)

# Generate model-generated cluster labels (assign each sample to a cluster)
model_generated_cluster_labels = np.array([0, 1, 2, 0, 1, 2, 0, 1, 2, 0], dtype=int)

# Generate target labels (ground truth cluster assignments)
target_labels = np.array([0, 0, 1, 1, 2, 2, 0, 1, 2, 0], dtype=int)

# Generate computed centroids (n_clusters x n_features)
computed_centroids = np.random.randn(n_clusters, n_features)

ARGS = {
    'model_generated_cluster_labels': model_generated_cluster_labels,
    'target_labels': target_labels,
    'feature_coll': feature_coll,
    'computed_centroids': computed_centroids
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
gimme_params Ran
ran, honoured the contract we drafted
Confusezius/CVPR2020_PADS/auxiliaries.py
code served (permissive licence) · get_code("e893025d6b83f9c4")
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 int64, ndim 0, dtype family int, shape () 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 torch.nn as nn
import numpy as np

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super(SimpleModel, self).__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int64, ndim 0, dtype family int, shape () — shape () 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
gimme_save_string Ran
ran; our contract draft was wrong, not the code
Confusezius/CVPR2020_PADS/auxiliaries.py
code served (permissive licence) · get_code("cae4f556b09f25d9")
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 str. 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)

class StandInOpt:
    def __init__(self):
        self.learning_rate = 0.001
        self.batch_size = 32
        self.num_epochs = 10
        self.model_config = {
            'hidden_dim': 128,
            'num_layers': 2,
            'dropout': 0.1
        }
        self.optimizer = 'adam'
        self.loss_function = 'cross_entropy'
        self.nested_dict = {
            'param1': 'value1',
            'param2': 42,
            'param3': 3.14
        }

opt = StandInOpt()

ARGS = {
    'opt': opt
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
give_CARS196_datasets Ran
ran on a synthesized input
Confusezius/CVPR2020_PADS/datasets.py
code served (permissive licence) · get_code("0f763cf3b0f17255")
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 dict. 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
import os
import tempfile
from PIL import Image
import shutil

# Create a minimal mock opt object
class MockOpt:
    def __init__(self):
        self.arch = 'resnet50'
        self.source_path = None
        self.sampling = 'learned'
        self.train_val_split_by_class = True
        self.train_val_split = 0.5
        self.samples_per_class = 8

# Create temporary directory structure with mock images
temp_dir = tempfile.mkdtemp()
images_dir = os.path.join(temp_dir, 'images')
os.makedirs(images_dir)

# Create mock class directories with images
num_classes = 4
images_per_class = 3

for class_idx in range(num_classes):
    class_dir = os.path.join(images_dir, f'class_{class_idx:03d}')
    os.makedirs(class_dir)
    
    for img_idx in range(images_per_class):
        # Create a small RGB image
        img = Image.new('RGB', (224, 224), color=(73, 109, 137))
        img_path = os.path.join(class_dir, f'image_{img_idx:03d}.jpg')
        img.save(img_path)

# Create mock opt with source_path
opt = MockOpt()
opt.source_path = temp_dir

ARGS = {
    'opt': opt
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, pandas, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
give_CUB200_datasets Ran
ran on a synthesized input
Confusezius/CVPR2020_PADS/datasets.py
code served (permissive licence) · get_code("97b7e4f5f24b8a40")
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 dict. 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 numpy as np
from unittest.mock import Mock
import tempfile
import os
from PIL import Image

torch.manual_seed(0)

# Create a temporary directory structure for CUB-200-2011
temp_dir = tempfile.mkdtemp()
images_dir = os.path.join(temp_dir, 'images')
os.makedirs(images_dir)

# Create mock class directories and images
num_classes = 10
images_per_class = 5

for class_idx in range(1, num_classes + 1):
    class_dir = os.path.join(images_dir, f'{class_idx:03d}.species_name')
    os.makedirs(class_dir)
    
    for img_idx in range(images_per_class):
        # Create a small dummy image
        img = Image.new('RGB', (224, 224), color=(73, 109, 137))
        img_path = os.path.join(class_dir, f'image_{img_idx:03d}.jpg')
        img.save(img_path)

# Create a mock options object
opt = Mock()
opt.source_path = temp_dir
opt.arch = 'resnet50'
opt.sampling = 'learned'
opt.train_val_split_by_class = True
opt.train_val_split = 0.8
opt.workers = 4
opt.batch_size = 8
opt.samples_per_class = 4
opt.seed = 0
opt.log_online = False
opt.project = 'test_project'
opt.group = 'test_group'
opt.name = 'test_run'

ARGS = {
    'opt': opt
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, pandas, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
multi_getattr Ran
ran on a synthesized input
Confusezius/CVPR2020_PADS/netlib.py
code served (permissive licence) · get_code("bdf29c0d682591c7")
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 Parameter, 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 torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer1 = nn.Linear(4, 3)
        self.layer2 = nn.Linear(3, 2)
        self.nested = nn.Module()
        self.nested.deep = nn.Linear(2, 1)

obj = SimpleModule()

ARGS = {
    "obj": obj,
    "attr": "layer1.weight"
}
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 Parameter, ndim 2, dtype family float — no output shape is stated: observe_signature.py recorded Tensor ndim 2, which disagrees with the fixture run
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
give_dataloaders Not yet run
unverified (harvested, no recorded run)
Confusezius/CVPR2020_PADS/datasets.py
code served (permissive licence) · get_code("3528797a933b875e")
How it ran

no invocation recorded.

include_pads_args Not yet run
unverified (harvested, no recorded run)
Confusezius/CVPR2020_PADS/PADS_utilities.py
code served (permissive licence) · get_code("b3cf33b121707ec1")
How it ran

no invocation recorded.

loss_select Not yet run
unverified (harvested, no recorded run)
Confusezius/CVPR2020_PADS/losses.py
code served (permissive licence) · get_code("ac8bd7c0c9d5cc4c")
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, 0 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
gimme_params 3 other papers
1 dated earlier, 2 later
2002.08473 (2020-02)
Revisiting Training Strategies and Generalization Performance in Deep Metric Learning
2108.11179 (2021-08)
Recall@k Surrogate Loss with Large Batches and Similarity Mixup
gimme_save_string 3 other papers
1 dated earlier, 2 later
2002.08473 (2020-02)
Revisiting Training Strategies and Generalization Performance in Deep Metric Learning
2108.11179 (2021-08)
Recall@k Surrogate Loss with Large Batches and Similarity Mixup

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

Learning visual similarity requires to learn relations, typically between triplets of images. Albeit triplet approaches being powerful, their computational complexity mostly limits training to only a subset of all possible training triplets. Thus, sampling strategies that decide when to use which training sample during learning are crucial. Currently, the prominent paradigm are fixed or curriculum sampling strategies that are predefined before training starts. However, the problem truly calls for a sampling process that adjusts based on the actual state of the similarity representation during training. We, therefore, employ reinforcement learning and have a teacher network adjust the sampling distribution based on the current state of the learner network, which represents visual similarity. Experiments on benchmark datasets using standard triplet-based losses show that our adaptive sampling strategy significantly outperforms fixed sampling strategies. Moreover, although our adaptive sampling is only applied on top of basic triplet-learning frameworks, we reach competitive results to state-of-the-art approaches that employ diverse additional learning signals or strong ensemble architectures. Code can be found under https://github.com/Confusezius/CVPR2020_PADS.

For agents

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

get_harvested_code_for_paper("2003.11113")
get_code_for_paper("2003.11113")
have("2003.11113")

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

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

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

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

Connect an agent — have() is free.