SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2308.09242 · ICCV · 2023

ASAG: Building Strong One-Decoder-Layer Sparse Detectors via Adaptive Sparse Anchor Generation

Yipeng Gao, Wei-Shi Zheng, Shenghao Fu, Junkai Yan, Xiaohua Xie

arXiv · PDF · Open in the Atlas

Code that ran

2 of 2 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 1 failure of our instrument; 0 no recorded run), measured 2026-11-23; 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/2308.09242.json · badge: /api/ran/2308.09242.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
isee-laboratory/asag marked official in Papers with Code
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
ASAG Ran
ran on a synthesized input · constructed an object; no result was computed
isee-laboratory/asag/models/asag.py
code served (permissive licence) · get_code("2ba52d432f381321")
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 an instance of its own class, ASAG: the run constructed the object and did not call it, so no result was computed. 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 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

torch.manual_seed(0)

# Create minimal nn.Module implementations for required components

class MinimalBackbone(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(3, 64, 3)
    
    def forward(self, x):
        return self.conv(x)

class MinimalNeck(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(64, 256, 1)
    
    def forward(self, x):
        return self.conv(x)

class MinimalAnchorGenerator(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        # Returns anchors in cxcywh format
        batch_size = x.shape[0]
        num_anchors = 10
        return torch.rand(batch_size, num_anchors, 4)

class MinimalRPN(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(256, 64)
    
    def forward(self, x):
        return self.fc(x.flatten(1))

class MinimalDecoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.num_layers = 3
        self.fc = nn.Linear(64, 32)
    
    def forward(self, x):
        return self.fc(x)

class MinimalArgs:
    def __init__(self):
        self.use_dn = True
        self.num_dn = 5

# Prepare arguments for prepare_for_dn function
device = torch.device('cpu')
batch_size = 2
num_anchors = 10

# Create test data for prepare_for_dn
use_dn = True
training = True
anchors = torch.rand(batch_size, num_anchors, 4) * torch.tensor([1.0, 1.0, 1.0, 1.0])
valid_anchor_mask = torch.ones(batch_size, num_anchors, dtype=torch.bool)
valid_anchor_mask[0, 8:] = False
valid_anchor_mask[1, 9:] = False
imgs_whwh = torch.tensor([[[640.0, 480.0, 640.0, 480.0]], [[640.0, 480.0, 640.0, 480.0]]])

# Create target data
targets = []
for i in range(batch_size):
    if i == 0:
        target = {
            'boxes': torch.tensor([[0.3, 0.4, 0.2, 0.3], [0.6, 0.5, 0.15, 0.25]]),
            'labels': torch.tensor([1, 2])
        }
    else:
        target = {
            'boxes': torch.tensor([[0.5, 0.5, 0.1, 0.1]]),
            'labels': torch.tensor([0])
        }
    targets.append(target)

num_dn = 5
box_noise_scale = 0.4
dn_args = (targets, num_dn, box_noise_scale)

# Create ASAG-specific arguments
args = MinimalArgs()
backbone = MinimalBackbone()
neck = MinimalNeck()
anchor_generator = MinimalAnchorGenerator()
rpn = MinimalRPN()
decoder = MinimalDecoder()

ARGS = {
    'args': args,
    'backbone': backbone,
    'neck': neck,
    'anchor_generator': anchor_generator,
    'rpn': rpn,
    'decoder': decoder
}
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 ASAG — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ASAG 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
prepare_for_dn Ran
ran; our contract draft was wrong, not the code
isee-laboratory/asag/models/asag.py
code served (permissive licence) · get_code("19be4d355b676acc")
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. 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

torch.manual_seed(0)

# Batch size and anchor parameters
batch_size = 2
num_anchors = 5
num_boxes = 3

# Create anchors: (batch_size, num_anchors, 4) in 'cxcywh' format
anchors = torch.rand(batch_size, num_anchors, 4) * 2

# Create valid_anchor_mask: (batch_size, num_anchors)
valid_anchor_mask = torch.ones(batch_size, num_anchors, dtype=torch.bool)
valid_anchor_mask[0, -1] = False  # Make one anchor invalid in first batch
valid_anchor_mask[1, -2:] = False  # Make two anchors invalid in second batch

# Create imgs_whwh: (batch_size, 1, 4)
imgs_whwh = torch.tensor([[[640.0, 480.0, 640.0, 480.0]],
                           [[800.0, 600.0, 800.0, 600.0]]], dtype=torch.float32)

# Create targets for dn_args
targets = []
for b in range(batch_size):
    target = {}
    target['boxes'] = torch.rand(num_boxes, 4) * 0.8 + 0.1  # Random boxes in [0.1, 0.9]
    target['labels'] = torch.randint(0, 10, (num_boxes,))
    targets.append(target)

# dn_args: (targets, num_dn, box_noise_scale)
num_dn = 6
box_noise_scale = 0.4
dn_args = (targets, num_dn, box_noise_scale)

ARGS = {
    'use_dn': True,
    'training': True,
    'dn_args': dn_args,
    'anchors': anchors,
    'valid_anchor_mask': valid_anchor_mask,
    'imgs_whwh': imgs_whwh,
}
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 tuple — a tuple output has no array shape of its own; none is 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

Also present in other papers' code

Of 2 samples lifted from this paper's linked repositories, 2 carry a function identity and 0 do not. Of the 2 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 2 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-23.

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 sparse detectors with multiple, e.g. six, decoder layers achieve promising performance but much inference time due to complex heads. Previous works have explored using dense priors as initialization and built one-decoderlayer detectors. Although they gain remarkable acceleration, their performance still lags behind their six-decoderlayer counterparts by a large margin. In this work, we aim to bridge this performance gap while retaining fast speed. We find that the architecture discrepancy between dense and sparse detectors leads to feature conflict, hampering the performance of one-decoder-layer detectors. Thus we propose Adaptive Sparse Anchor Generator (ASAG) which predicts dynamic anchors on patches rather than grids in a sparse way so that it alleviates the feature conflict problem. For each image, ASAG dynamically selects which feature maps and which locations to predict, forming a fully adaptive way to generate image-specific anchors. Further, a simple and effective Query Weighting method eases the training instability from adaptiveness. Extensive experiments show that our method outperforms denseinitialized ones and achieves a better speed-accuracy tradeoff. The code is available at https://github.com/ iSEE-Laboratory/ASAG.

For agents

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

get_harvested_code_for_paper("2308.09242")
get_code_for_paper("2308.09242")
have("2308.09242")

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

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

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

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

Connect an agent — have() is free.