SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.04742 · ICCV · 2023

Detection Transformer with Stable Matching

Hang Su, Jun Zhu, Lei Zhang, Hongyang Li, Hao Zhang, Jiayu Chen, Shilong Liu, Feng Li, Tianhe Ren, Jun Huang, Zhaoyang Zeng

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 3 failures of our instrument; 2 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/2304.04742.json · badge: /api/ran/2304.04742.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
IDEA-Research/Stable-DINO canonical (classifier label)
classifier basis not recorded on the link
1 ran · 0 no recorded run
IDEA-Research/detrex community
Papers with Code archive
6 ran · 1 no recorded run
fundamentalvision/Deformable-DETR community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
FocalLossCost Ran
ran on a synthesized input · constructed an object; no result was computed
IDEA-Research/detrex/detrex/modeling/matcher/modified_matcher.py
code served (permissive licence) · get_code("3f8838b327e62992")
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, FocalLossCost: the run constructed the object and did not call it, so no result was computed. 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 FocalLossCost(nn.Module):

    def __init__(self, alpha: float=0.25, gamma: float=2.0, weight: float=1.0, eps: float=1e-08):
        super().__init__()
        self.alpha = alpha
        self.gamma = gamma
        self.weight = weight
        self.eps = eps

    def forward(self, pred_logits, gt_labels):
        """
        Args:
            pred_logits (nn.Tensor): Predicted classification logits.
            gt_labels (nn.Tensor): Ground truth labels.

        Return:
            nn.Tensor: Focal loss cost matrix with weight in shape
                ``(num_queries, num_gt)``
        """
        alpha = self.alpha
        gamma = self.gamma
        eps = self.eps
        out_prob = pred_logits.sigmoid()
        neg_cost_class = (1 - alpha) * out_prob ** gamma * -(1 - out_prob + eps).log()
        pos_cost_class = alpha * (1 - out_prob) ** gamma * -(out_prob + eps).log()
        cost_class = pos_cost_class[:, gt_labels] - neg_cost_class[:, gt_labels]
        return cost_class * self.weight


# Create sample tensors
# pred_logits: shape (num_queries, num_classes) = (2, 4)
pred_logits = torch.randn(2, 4)

# gt_labels: shape (num_gt,) with class indices = (3,)
# Values should be indices in range [0, num_classes), so [0, 4)
gt_labels = torch.tensor([0, 2, 3])

ARGS = {
    "alpha": 0.25,
    "gamma": 2.0,
    "weight": 1.0,
    "eps": 1e-08,
}
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 FocalLossCost — 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 FocalLossCost 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
GIoUCost Ran
ran on a synthesized input · constructed an object; no result was computed
IDEA-Research/detrex/detrex/modeling/matcher/modified_matcher.py
code served (permissive licence) · get_code("570320cdbc1ac2d2")
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, GIoUCost: the run constructed the object and did not call it, so no result was computed. 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 torchvision.ops.boxes import box_area

torch.manual_seed(0)

# Create sample bounding boxes in (x0, y0, x1, y1) format
# pred_bboxes: (num_queries, 4)
pred_bboxes = torch.tensor([
    [10.0, 20.0, 50.0, 60.0],
    [15.0, 25.0, 55.0, 65.0]
], dtype=torch.float32)

# gt_bboxes: (num_gt, 4)
gt_bboxes = torch.tensor([
    [12.0, 22.0, 52.0, 62.0],
    [20.0, 30.0, 60.0, 70.0],
    [5.0, 10.0, 40.0, 50.0]
], dtype=torch.float32)

ARGS = {
    "weight": 1.0
}
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 GIoUCost — 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 GIoUCost 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
L1Cost Ran
ran on a synthesized input
IDEA-Research/detrex/detrex/modeling/matcher/modified_matcher.py
code served (permissive licence) · get_code("12e38e14abb434a8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (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
import torch.nn as nn

class L1Cost(nn.Module):

    def __init__(self, weight: float=1.0):
        super().__init__()
        self.weight = weight

    def forward(self, pred_bboxes, gt_bboxes):
        """
        Args:
            pred_bboxes (Tensor): Predicted boxes with normalized coordinates
                (cx, cy, w, h), which are all in range [0, 1] with shape
                (num_queries, 4).
            gt_bboxes (Tensor): Ground truth boxes with normalized
                coordinates (cx, cy, w, h) with shape (num_gt, 4).

        Returns:
            torch.Tensor: cost_bbox with weight
        """
        cost_bbox = torch.cdist(pred_bboxes, gt_bboxes, p=1)
        return cost_bbox * self.weight


INIT_ARGS = {
    'weight': 2.5
}

ARGS = {
    'pred_bboxes': torch.rand(3, 4),
    'gt_bboxes': torch.rand(2, 4)
}

if __name__ == '__main__':
    model = L1Cost(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output:\n{output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 (3, 2) — shape (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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
box_cxcywh_to_xyxy Ran
ran; our contract draft was wrong, not the code
IDEA-Research/detrex/detrex/modeling/matcher/modified_matcher.py
code served (permissive licence) · get_code("856982244cffd7e3")
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, 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 torch

torch.manual_seed(0)

# Create a small batch of bounding boxes in (cx, cy, w, h) format
# Shape: (2, 4) - 2 bounding boxes, each with 4 values
bbox = torch.tensor([
    [50.0, 50.0, 20.0, 30.0],  # cx=50, cy=50, w=20, h=30
    [100.0, 100.0, 40.0, 50.0]  # cx=100, cy=100, w=40, h=50
], dtype=torch.float32)

ARGS = {
    "bbox": bbox
}
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, 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
box_iou Ran
ran; our contract draft was wrong, not the code
IDEA-Research/detrex/detrex/modeling/matcher/modified_matcher.py
code served (permissive licence) · get_code("d8e49e4f454b76fc")
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 tuple, ndim 3, 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
from torchvision.ops.boxes import box_area

torch.manual_seed(0)

# Create two sets of bounding boxes in format [x1, y1, x2, y2]
# boxes1: N=2 boxes
boxes1 = torch.tensor([
    [0.0, 0.0, 10.0, 10.0],
    [5.0, 5.0, 15.0, 15.0]
], dtype=torch.float32)

# boxes2: M=3 boxes
boxes2 = torch.tensor([
    [0.0, 0.0, 5.0, 5.0],
    [7.0, 7.0, 12.0, 12.0],
    [20.0, 20.0, 25.0, 25.0]
], dtype=torch.float32)

ARGS = {
    "boxes1": boxes1,
    "boxes2": boxes2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, 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
generalized_box_iou Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
IDEA-Research/detrex/detrex/modeling/matcher/modified_matcher.py
code served (permissive licence) · get_code("be174c5da2b1ca9a")
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)

# Create two sets of bounding boxes in (x0, y0, x1, y1) format
# boxes1: N=2 boxes
# boxes2: M=3 boxes
boxes1 = torch.tensor([
    [10.0, 20.0, 30.0, 40.0],
    [50.0, 60.0, 80.0, 90.0]
], dtype=torch.float32)

boxes2 = torch.tensor([
    [15.0, 25.0, 35.0, 45.0],
    [12.0, 22.0, 28.0, 38.0],
    [55.0, 65.0, 75.0, 85.0]
], dtype=torch.float32)

ARGS = {
    "boxes1": boxes1,
    "boxes2": boxes2,
}
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, 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
sigmoid_focal_loss Ran
ran on a synthesized input
IDEA-Research/Stable-DINO/projects/stabledino/modeling/dn_criterion.py
pointer only (licence: Apache-2.0) · get_code("97059585f50ae421")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, IDEA-Research/Stable-DINO, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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.

HungarianMatcher Not yet run
unverified (harvested, no recorded run)
IDEA-Research/detrex/detrex/modeling/matcher/modified_matcher.py
code served (permissive licence) · get_code("f1c2b24b9f7949dd")
How it ran

no invocation recorded.

SetCriterion Not yet run
unverified (harvested, no recorded run)
fundamentalvision/Deformable-DETR/models/deformable_detr.py
code served (permissive licence) · get_code("66ff5da6253f8775")
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, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 7 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
box_cxcywh_to_xyxy
brick of this paper's assembly: helper
5 other papers
5 later
2309.12969 (2023-09)
Detect Everything with Few Examples
2402.03094 (2024-02)
Cross-Domain Few-Shot Object Detection via Enhanced Open-Set Object Detector
Zhou_When_Pixel_Difference_Patterns_Meet_ViT_PiDiViT_for_Few-Shot_Object_ICCV_2025_paper (2025 (year only))
When Pixel Difference Patterns Meet ViT: PiDiViT for Few-Shot Object Detection
and 2 more not named here
box_iou
brick of this paper's assembly: helper
2 other papers
2 later
2501.06710 (2025-01)
Multi-task Visual Grounding with Coarse-to-Fine Consistency Constraints
2509.04833 (2025-09)
PropVG: End-to-End Proposal-Driven Visual Grounding with Multi-Granularity Discrimination

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

This paper is concerned with the matching stability problem across different decoder layers in DEtection TRansformers (DETR). We point out that the unstable matching in DETR is caused by a multi-optimization path problem, which is highlighted by the one-to-one matching design in DETR. To address this problem, we show that the most important design is to use and only use positional metrics (like IOU) to supervise classification scores of positive examples. Under the principle, we propose two simple yet effective modifications by integrating positional metrics to DETR's classification loss and matching cost, named positionsupervised loss and position-modulated cost. We verify our methods on several DETR variants. Our methods show consistent improvements over baselines. By integrating our methods with DINO, we achieve 50.4 and 51.5 AP on the COCO detection benchmark using ResNet-50 backbones under 1× (12 epochs) and 2× (24 epochs) training settings, achieving a new record under the same setting. We achieve 63.8 AP on COCO detection test-dev with a Swin-Large backbone. Our code will be made available at https:// github.com/IDEA-Research/Stable-DINO.

For agents

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

get_harvested_code_for_paper("2304.04742")
get_code_for_paper("2304.04742")
have("2304.04742")

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

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

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

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

Connect an agent — have() is free.