SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2001.08972 · 2020

SOLAR: Second-Order Loss and Attention for Image Retrieval

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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 6 have no contract verdict; 2 failures of our instrument; 1 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/2001.08972.json · badge: /api/ran/2001.08972.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
tonyngjichun/SOLAR canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
cid2filename Ran
ran; our contract draft was wrong, not the code
tonyngjichun/SOLAR/solar_global/datasets/datahelpers.py
code served (permissive licence) · get_code("d685ee65d8c6494e")
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 os

# Analyze the function:
# - cid: string parameter, used with string slicing (cid[-2:], cid[-4:-2], cid[-6:-4], cid)
# - prefix: string parameter, used with os.path.join()
# The function constructs a file path by taking substrings of cid and joining them with prefix

# Create valid arguments
# cid needs to be at least 6 characters long to support cid[-6:-4]
cid = "abc123def456"  # 12 characters, supports all the slicing operations
prefix = "/data/images"

ARGS = {
    "cid": cid,
    "prefix": prefix,
}
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 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
describe_opencv Ran
ran on a synthesized input
tonyngjichun/SOLAR/solar_local/utils.py
code served (permissive licence) · get_code("c20e999369e91a66")
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, 128) 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 cv2
import torch
import torch.nn as nn
import numpy as np
import math

torch.manual_seed(0)

# Create a small model that takes patches and returns descriptors
class SimpleDescriptorModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(32 * 32, 128)
    
    def forward(self, x):
        # x shape: (batch, 1, 32, 32)
        batch_size = x.shape[0]
        x = x.view(batch_size, -1)
        return self.fc(x)

# Create a mock keypoint class matching cv2.KeyPoint interface
class MockKeyPoint:
    def __init__(self, x, y, size, angle):
        self.pt = (x, y)
        self.size = size
        self.angle = angle

# Create test image (grayscale)
img = np.random.randint(0, 256, (100, 100), dtype=np.uint8)

# Create keypoints with varying positions, sizes, and angles
kpts = [
    MockKeyPoint(x=30.0, y=40.0, size=16.0, angle=45.0),
    MockKeyPoint(x=70.0, y=60.0, size=20.0, angle=90.0)
]

# Create model
model = SimpleDescriptorModel()

ARGS = {
    'model': model,
    'img': img,
    'kpts': kpts,
    'patch_size': 32,
    'mag_factor': 3,
    'use_gpu': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, 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 2, dtype family float, shape (2, 128) — shape (2, 128) 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
extract_features_from_e2e Ran
ran on a synthesized input
tonyngjichun/SOLAR/solar_global/networks/networks.py
code served (permissive licence) · get_code("6684ed5968a704c5")
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 OrderedDict. 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 collections import OrderedDict

torch.manual_seed(0)

# Create a minimal model with state_dict containing 'features' keys
model_state_dict = OrderedDict()

# Add some tensors with 'features' prefix
model_state_dict['features.0.weight'] = torch.randn(4, 3)
model_state_dict['features.0.bias'] = torch.randn(4)
model_state_dict['features.1.weight'] = torch.randn(5, 4)
model_state_dict['other.weight'] = torch.randn(2, 3)  # This should not be included

# Create the model dict that the function expects
model = {
    'state_dict': model_state_dict
}

ARGS = {
    'model': model
}
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 OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict 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
extract_ss Ran
ran on a synthesized input
tonyngjichun/SOLAR/solar_global/networks/imageretrievalnet.py
code served (permissive licence) · get_code("76b4b2555cd2562e")
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
import torch.nn as nn

torch.manual_seed(0)

class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

net = SimpleNet()
_input = torch.randn(2, 4)

ARGS = {
    "net": net,
    "_input": _input
}
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
gem Ran
ran; our contract draft was wrong, not the code
tonyngjichun/SOLAR/solar_global/layers/functional.py
code served (permissive licence) · get_code("ad695e1e64bd704c")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 1, 1) 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.functional as F

torch.manual_seed(0)

# The gem function expects:
# - x: a 4D tensor (batch, channels, height, width) for avg_pool2d
# - p: a numeric parameter (default 3)
# - eps: a small epsilon value (default 1e-06)

# Create a small 4D tensor: batch=2, channels=4, height=3, width=5
x = torch.randn(2, 4, 3, 5)

# p is the power parameter
p = 3

# eps is the epsilon for clamping
eps = 1e-06

ARGS = {
    "x": x,
    "p": p,
    "eps": eps
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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, 1, 1) — shape (2, 4, 1, 1) 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
mac Ran
ran on a synthesized input
tonyngjichun/SOLAR/solar_global/layers/functional.py
code served (permissive licence) · get_code("d57f881947d223c7")
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, 1, 1) 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.functional as F

torch.manual_seed(0)

# Create a small 4D tensor suitable for max_pool2d
# Shape: (batch=2, channels=4, height=3, width=5)
x = torch.randn(2, 4, 3, 5)

ARGS = {
    'x': x
}
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, 1, 1) — shape (2, 4, 1, 1) 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
pil_loader Ran
ran on a synthesized input
tonyngjichun/SOLAR/solar_global/datasets/datahelpers.py
code served (permissive licence) · get_code("6b9efe81c25c42e5")
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 Image. 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 tempfile
import os
from PIL import Image

# Create a temporary directory and a valid test image
temp_dir = tempfile.mkdtemp()
test_image_path = os.path.join(temp_dir, "test_image.jpg")

# Create a simple RGB image and save it
img = Image.new('RGB', (100, 100), color='red')
img.save(test_image_path)

ARGS = {
    'path': test_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
spoc Ran
ran on a synthesized input
tonyngjichun/SOLAR/solar_global/layers/functional.py
code served (permissive licence) · get_code("40aedf01731c3391")
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, 1, 1) 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.functional as F

torch.manual_seed(0)

# x is a 4D tensor (batch, channels, height, width)
# The function calls x.size(-2) and x.size(-1) to get height and width
# Then applies avg_pool2d with kernel size (height, width)
# This performs global average pooling
x = torch.randn(2, 4, 3, 5)

ARGS = {
    'x': x
}
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, 1, 1) — shape (2, 4, 1, 1) 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
accimage_loader Not yet run
unverified (harvested, no recorded run)
tonyngjichun/SOLAR/solar_global/datasets/datahelpers.py
code served (permissive licence) · get_code("3442ee8338b2ae1b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 4 later) and 4 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
accimage_loader 39 other papers
5 dated earlier, 34 later
1702.00758 (2017-02)
HashNet: Deep Learning to Hash by Continuation
1711.02512 (2017-11)
Fine-tuning CNN Image Retrieval with No Human Annotation
1805.00907 (2018-05)
Glow: Graph Lowering Compiler Techniques for Neural Networks
and 36 more not named here
gem 7 other papers
2 dated earlier, 5 later
1711.02512 (2017-11)
Fine-tuning CNN Image Retrieval with No Human Annotation
1901.10332 (2019-01)
Who's Afraid of Adversarial Queries? The Impact of Image Modifications on Content-based Image Retrieval
2107.07728 (2021-07)
Recognizing bird species in diverse soundscapes under weak supervision
and 4 more not named here
mac 2 other papers
1 dated earlier, 1 later
1711.02512 (2017-11)
Fine-tuning CNN Image Retrieval with No Human Annotation
2203.01851 (2022-03)
STUN: Self-Teaching Uncertainty Estimation for Place Recognition
spoc 2 other papers
1 dated earlier, 1 later
1711.02512 (2017-11)
Fine-tuning CNN Image Retrieval with No Human Annotation
2203.01851 (2022-03)
STUN: Self-Teaching Uncertainty Estimation for Place Recognition
cid2filename 1 other paper
1 dated earlier
1711.02512 (2017-11)
Fine-tuning CNN Image Retrieval with No Human Annotation

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

Recent works in deep-learning have shown that second-order information is beneficial in many computer-vision tasks. Second-order information can be enforced both in the spatial context and the abstract feature dimensions. In this work, we explore two second-order components. One is focused on second-order spatial information to increase the performance of image descriptors, both local and global. It is used to re-weight feature maps, and thus emphasise salient image locations that are subsequently used for description. The second component is concerned with a second-order similarity (SOS) loss, that we extend to global descriptors for image retrieval, and is used to enhance the triplet loss with hard-negative mining. We validate our approach on two different tasks and datasets for image retrieval and image matching. The results show that our two second-order components complement each other, bringing significant performance improvements in both tasks and lead to state-of-the-art results across the public benchmarks. Code available at: http://github.com/tonyngjichun/SOLAR

For agents

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

get_harvested_code_for_paper("2001.08972")
get_code_for_paper("2001.08972")
have("2001.08972")

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

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

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

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

Connect an agent — have() is free.