SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2003.06800 · 2020

OS2D: One-Stage One-Shot Object Detection by Matching Anchor Features

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 8 have no contract verdict; 0 failures 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.06800.json · badge: /api/ran/2003.06800.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
aosokin/os2d canonical (classifier label)
classifier basis: census
8 ran · 3 no recorded run
FunctionStatusWhere it lives
box_intersection_over_reference Ran
ran on a synthesized input
aosokin/os2d/os2d/structures/bounding_box.py
code served (permissive licence) · get_code("8e6c777e0e52dff9")
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

torch.manual_seed(0)

class BoxList:
    def __init__(self, bbox_xyxy, image_size):
        self.bbox_xyxy = bbox_xyxy
        self.image_size = image_size
    
    def area(self):
        # Calculate area from xyxy format: (x1, y1, x2, y2)
        # area = (x2 - x1) * (y2 - y1)
        widths = self.bbox_xyxy[:, 2] - self.bbox_xyxy[:, 0]
        heights = self.bbox_xyxy[:, 3] - self.bbox_xyxy[:, 1]
        return widths * heights

# Create sample bounding boxes in xyxy format
# boxes_reference: 2 boxes
bbox_ref = torch.tensor([
    [0.0, 0.0, 10.0, 10.0],
    [5.0, 5.0, 15.0, 15.0]
], dtype=torch.float32)

# boxes: 3 boxes
bbox_test = torch.tensor([
    [2.0, 2.0, 8.0, 8.0],
    [7.0, 7.0, 12.0, 12.0],
    [0.0, 0.0, 5.0, 5.0]
], dtype=torch.float32)

boxes_reference = BoxList(bbox_ref, image_size=(100, 100))
boxes = BoxList(bbox_test, image_size=(100, 100))

ARGS = {
    "boxes_reference": boxes_reference,
    "boxes": boxes
}
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
boxlist_iou Ran
ran on a synthesized input
aosokin/os2d/os2d/structures/bounding_box.py
code served (permissive licence) · get_code("6e0da76055e84b59")
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
from torchvision.ops.boxes import box_iou

torch.manual_seed(0)

class BoxList:
    """Stand-in BoxList class with required attributes."""
    def __init__(self, bbox_xyxy, image_size):
        self.bbox_xyxy = bbox_xyxy
        self.image_size = image_size

# Create two BoxList instances with matching image sizes
bbox1 = torch.tensor([
    [10.0, 20.0, 30.0, 40.0],
    [50.0, 60.0, 70.0, 80.0]
], dtype=torch.float32)

bbox2 = torch.tensor([
    [15.0, 25.0, 35.0, 45.0],
    [55.0, 65.0, 75.0, 85.0]
], dtype=torch.float32)

image_size = (100, 100)

boxlist1 = BoxList(bbox_xyxy=bbox1, image_size=image_size)
boxlist2 = BoxList(bbox_xyxy=bbox2, image_size=image_size)

ARGS = {
    'boxlist1': boxlist1,
    'boxlist2': boxlist2
}
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 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
convert_box_coordinates_local_to_global Ran
ran on a synthesized input
aosokin/os2d/os2d/modeling/head.py
code served (permissive licence) · get_code("4d055f5969d17147")
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 4, dtype family float, shape (2, 4, 3, 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

torch.manual_seed(0)

# resampling_grids: shape (batch, height, width, 2) - contains normalized x,y coordinates
# The function uses .dim(), .size(-2), .size(-3), .narrow(-1, 0, 1), .narrow(-1, 1, 1)
resampling_grids = torch.randn(2, 4, 3, 2)

# default_boxes_xyxy: shape (num_boxes, 4) - contains [x1, y1, x2, y2] coordinates
# The function uses .narrow(-1, 0, 1), .narrow(-1, 1, 1), .narrow(-1, 2, 1), .narrow(-1, 3, 1)
default_boxes_xyxy = torch.tensor([
    [0.1, 0.1, 0.9, 0.9],
    [0.2, 0.2, 0.8, 0.8]
], dtype=torch.float32)

ARGS = {
    "resampling_grids": resampling_grids,
    "default_boxes_xyxy": default_boxes_xyxy,
}
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 4, dtype family float, shape (2, 4, 3, 2) — shape (2, 4, 3, 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
create_optimizer Ran
ran on a synthesized input
aosokin/os2d/os2d/engine/optimization.py
code served (permissive licence) · get_code("1fe23cf1e42b8198")
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 Adam. 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 torch import optim
import logging

# Set up logging
logging.basicConfig()

# Create a minimal config object with required attributes
class MinimalConfig:
    def __init__(self):
        self.lr = 0.001
        self.optim_method = 'adam'
        self.weight_decay = 0.0001
        self.sgd_momentum = 0.9

# Create a minimal neural network with parameters
class MinimalModel(nn.Module):
    def __init__(self):
        super().__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

# Set random seed for reproducibility
torch.manual_seed(0)

# Create instances
model = MinimalModel()
cfg = MinimalConfig()
parameters = model.parameters()

# Create optimizer_state by first creating an optimizer and getting its state
temp_optimizer = optim.Adam(parameters, lr=cfg.lr, weight_decay=cfg.weight_decay)
optimizer_state = temp_optimizer.state_dict()

# Define ARGS dict with all parameters
ARGS = {
    'parameters': model.parameters(),
    'cfg': cfg,
    'optimizer_state': optimizer_state
}
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 Adam — a Adam output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Adam 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
get_learning_rate Ran
ran on a synthesized input
aosokin/os2d/os2d/engine/optimization.py
code served (permissive licence) · get_code("3113a246d0a2ab8e")
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 float, ndim 0, dtype family float, 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
from torch.optim import SGD

torch.manual_seed(0)

# Create a simple model
model = nn.Linear(4, 3)

# Create an optimizer with a learning rate
optimizer = SGD(model.parameters(), lr=0.01)

# Construct the arguments dict
ARGS = {
    'optimizer': optimizer
}
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 float, ndim 0, dtype family float, 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
get_norm_layer Ran
ran on a synthesized input
aosokin/os2d/os2d/modeling/feature_extractor.py
code served (permissive licence) · get_code("6e8d97418bab5999")
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 function. 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)

GROUPNORM_NUMGROUPS = 32

def get_norm_layer(use_group_norm):
    if use_group_norm:
        return lambda width: torch.nn.GroupNorm(GROUPNORM_NUMGROUPS, width)
    else:
        return torch.nn.BatchNorm2d

ARGS = {
    "use_group_norm": True
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
nms Ran
ran on a synthesized input
aosokin/os2d/os2d/structures/bounding_box.py
code served (permissive licence) · get_code("d5dce16d64576aa1")
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 1, dtype family int, shape (2,) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 math

torch.manual_seed(0)

# Create a minimal BoxList-like class that supports the required interface
class MinimalBoxes:
    def __init__(self, bbox_xyxy, scores, labels=None):
        self.bbox_xyxy = bbox_xyxy
        self._fields = {'scores': scores}
        if labels is not None:
            self._fields['labels'] = labels
    
    def get_field(self, name):
        return self._fields[name]
    
    def __getitem__(self, indices):
        """Support indexing to create sub-boxes"""
        new_bbox = self.bbox_xyxy[indices]
        new_scores = self._fields['scores'][indices]
        new_labels = self._fields['labels'][indices] if 'labels' in self._fields else None
        return MinimalBoxes(new_bbox, new_scores, new_labels)

# Create sample data
# bbox_xyxy: format is (x1, y1, x2, y2) for 4 boxes
bbox_xyxy = torch.tensor([
    [10.0, 20.0, 50.0, 60.0],
    [15.0, 25.0, 55.0, 65.0],
    [100.0, 100.0, 150.0, 150.0],
    [105.0, 105.0, 155.0, 155.0],
], dtype=torch.float32)

# scores: confidence scores for each box
scores = torch.tensor([0.9, 0.8, 0.95, 0.7], dtype=torch.float32)

# labels: class labels for each box
labels = torch.tensor([0, 0, 1, 1], dtype=torch.long)

# Create boxes object
boxes = MinimalBoxes(bbox_xyxy, scores, labels)

ARGS = {
    'boxes': boxes,
    'nms_iou_threshold': 0.5,
    'nms_max_batch': 10000,
    'nms_score_threshold': 0.5,
    'do_separate_per_label': False,
}
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 Tensor, ndim 1, dtype family int, shape (2,) — shape (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
spatial_norm Ran
ran on a synthesized input
aosokin/os2d/os2d/modeling/head.py
code served (permissive licence) · get_code("2b72a04028a03a76")
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 4, dtype family float, shape (2, 4, 3, 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 torch

torch.manual_seed(0)

# Create a small feature mask tensor
# The function uses .size(), .view(), and .sum() with dim=2
# So we need a tensor with at least 3 dimensions
# Shape: (batch=2, channels=4, spatial_dims=3*5)
# This will be reshaped to (2, 4, 15) in the function
feature_mask = torch.randn(2, 4, 3, 5)

# Ensure all values are positive so division makes sense
feature_mask = torch.abs(feature_mask) + 0.1

ARGS = {
    "feature_mask": feature_mask
}
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 4, dtype family float, shape (2, 4, 3, 5) — shape (2, 4, 3, 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
crop Not yet run
unverified (harvested, no recorded run)
aosokin/os2d/os2d/structures/transforms.py
code served (permissive licence) · get_code("9f5563403f2b0046")
How it ran

no invocation recorded.

resize Not yet run
unverified (harvested, no recorded run)
aosokin/os2d/os2d/structures/transforms.py
code served (permissive licence) · get_code("cb8bbafb3b69dae8")
How it ran

no invocation recorded.

transpose Not yet run
unverified (harvested, no recorded run)
aosokin/os2d/os2d/structures/transforms.py
code served (permissive licence) · get_code("d71ba914f2705b13")
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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 11 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.

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

In this paper, we consider the task of one-shot object detection, which consists in detecting objects defined by a single demonstration. Differently from the standard object detection, the classes of objects used for training and testing do not overlap. We build the one-stage system that performs localization and recognition jointly. We use dense correlation matching of learned local features to find correspondences, a feed-forward geometric transformation model to align features and bilinear resampling of the correlation tensor to compute the detection score of the aligned features. All the components are differentiable, which allows end-to-end training. Experimental evaluation on several challenging domains (retail products, 3D objects, buildings and logos) shows that our method can detect unseen classes (e.g., toothpaste when trained on groceries) and outperforms several baselines by a significant margin. Our code is available online: https://github.com/aosokin/os2d .

For agents

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

get_harvested_code_for_paper("2003.06800")
get_code_for_paper("2003.06800")
have("2003.06800")

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

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

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

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

Connect an agent — have() is free.