SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.12612 · 2023

Less is More: Focus Attention for Efficient DETR

arXiv · PDF · Open in the Atlas

Code that ran

11 of 12 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 11 have no contract verdict; 0 failures of our instrument; 1 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/2307.12612.json · badge: /api/ran/2307.12612.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
linxid/Focus-DETR community (classifier label)
classifier basis not recorded on the link
11 ran · 1 no recorded run
FunctionStatusWhere it lives
area_box_grad Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/grad_ops.py
code served (permissive licence) · get_code("439ca3d20ddd3507")
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, 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 numpy as np

# Create a small box array with shape (2, 4)
# Each row represents a box with 4 coordinates
box = np.array([
    [10.0, 20.0, 30.0, 40.0],
    [5.0, 15.0, 25.0, 35.0]
], dtype=np.float32)

ARGS = {
    "box": box
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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, 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_cxcywh_to_xyxy Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/box_ops.py
code served (permissive licence) · get_code("074307e51146fa09")
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, 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 numpy as np

def box_cxcywh_to_xyxy(x):
    """box cxcywh to xyxy"""
    x_c, y_c, w, h = np.array_split(x, 4, axis=-1)
    b = [x_c - 0.5 * w, y_c - 0.5 * h, x_c + 0.5 * w, y_c + 0.5 * h]
    return np.stack(b, axis=-1).squeeze(-2)

# Create a small input array with shape (2, 4) - batch of 2, 4 values (cx, cy, w, h)
x = np.array([
    [10.0, 20.0, 4.0, 6.0],
    [30.0, 40.0, 8.0, 10.0]
], dtype=np.float32)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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, 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_xyxy_to_cxcywh Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/box_ops.py
code served (permissive licence) · get_code("dbb0d0f90ff599c4")
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 (1, 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 numpy as np

# The function expects x to be a numpy array that can be transposed and split
# It should have shape (1, 4) based on the final [0] indexing
# xyxy format: [x0, y0, x1, y1] for bounding boxes

x = np.array([[10.0, 20.0, 50.0, 80.0]])  # shape (1, 4): one box in xyxy format

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 (1, 4) — shape (1, 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_xyxy_to_xywh Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/box_ops.py
code served (permissive licence) · get_code("c7dc3cdd056cc5f7")
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 (1, 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 numpy as np

# Create a sample boxes array in xyxy format
# Shape: (1, 4) where each row is [xmin, ymin, xmax, ymax]
boxes = np.array([[10.0, 20.0, 50.0, 80.0]])

ARGS = {
    "boxes": boxes
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 (1, 4) — shape (1, 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
crop Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/transforms.py
code served (permissive licence) · get_code("3a961927a8349cc0")
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 numpy as np

# Create a small image (3D array: height, width, channels)
image = np.random.randint(0, 256, size=(10, 12, 3), dtype=np.uint8)

# Create a target dict with boxes and labels
target = {
    'boxes': np.array([[2.0, 2.0, 6.0, 6.0], [4.0, 4.0, 8.0, 8.0]]),
    'labels': np.array([1, 2]),
    'area': np.array([16.0, 16.0]),
    'iscrowd': np.array([0, 0]),
    'size': np.array([10, 12])
}

# Define the region to crop: (i, j, h, w)
# i=1, j=1, h=6, w=8 means start at row 1, col 1, crop 6 rows and 8 cols
region = (1, 1, 6, 8)

ARGS = {
    'image': image,
    'target': target,
    'region': region
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
grad_xywh_to_cxcy Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/grad_ops.py
code served (permissive licence) · get_code("b825001fb2f9656b")
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, 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 numpy as np

# Create a small test array with shape (2, 4)
# The function expects an array where:
# - arr[:, 0] is x
# - arr[:, 1] is y
# - arr[:, 2] is w (width)
# - arr[:, 3] is h (height)
arr = np.array([
    [10.0, 20.0, 30.0, 40.0],
    [5.0, 15.0, 25.0, 35.0]
], dtype=np.float32)

ARGS = {
    "arr": arr
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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, 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
hflip Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/transforms.py
code served (permissive licence) · get_code("3489d75749a692fb")
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 cv2
import numpy as np

# Create a small test image (height=4, width=3, channels=3)
image = np.random.randint(0, 256, size=(4, 3, 3), dtype=np.uint8)

# Create a target dict with bounding boxes
# boxes format: [x1, y1, x2, y2] - create 2 sample boxes
target = {
    'boxes': np.array([
        [0.5, 1.0, 2.0, 3.0],
        [0.2, 0.5, 1.5, 2.5]
    ], dtype=np.float32)
}

ARGS = {
    'image': image,
    'target': target
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — 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
merge Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/coco_eval.py
code served (permissive licence) · get_code("13cebdd9482d0683")
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 numpy as np

# Construct arguments for the merge function
# img_ids: list of image IDs
# eval_imgs: numpy array of evaluation images

# Create sample image IDs - a 1D list/array of image identifiers
img_ids = [1, 2, 3, 1, 2]

# Create sample evaluation images
# The function concatenates along axis 2, so shape should be (height, width, num_samples)
# Using distinct dimensions: 4 (height) x 3 (width) x 5 (num_samples)
eval_imgs = np.random.rand(4, 3, 5).astype(np.float32)

ARGS = {
    "img_ids": img_ids,
    "eval_imgs": eval_imgs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
pad_image_to_max_size Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/dataset.py
code served (permissive licence) · get_code("5a86d23535474849")
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 numpy as np

# Create a small test image with shape (channels, height, width)
# Using distinct dimensions: 3 channels, 4 height, 5 width
img = np.random.rand(3, 4, 5).astype(np.float32)

ARGS = {
    'img': img,
    'max_size': 1333
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
prepare_data Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/dataset.py
code served (permissive licence) · get_code("b7a71f5fa31b5a46")
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.

from PIL import Image
import numpy as np

# Create a small PIL Image object
image = Image.new('RGB', (640, 480))  # width=640, height=480

# Create target dict with COCO-style annotations
target = {
    'image_id': 42,
    'annotations': [
        {
            'bbox': [10, 20, 100, 150],  # [x, y, width, height]
            'category_id': 1,
            'area': 15000.0,
            'iscrowd': 0
        },
        {
            'bbox': [200, 150, 80, 120],
            'category_id': 2,
            'area': 9600.0,
            'iscrowd': 0
        },
        {
            'bbox': [300, 300, 50, 50],
            'category_id': 1,
            'area': 2500.0
            # 'iscrowd' not present - should default to 0
        }
    ]
}

ARGS = {
    'image': image,
    'target': target
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — 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
resize Ran
ran on a synthesized input
linxid/Focus-DETR/models/focus_detr/transforms.py
code served (permissive licence) · get_code("fbb85c3da476c722")
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 numpy as np
from PIL import Image

# Create a simple PIL Image for testing
image_array = np.random.randint(0, 256, (100, 80, 3), dtype=np.uint8)
image = Image.fromarray(image_array, mode='RGB')

# Create a target dict with boxes and area
target = {
    'boxes': np.array([[10, 15, 40, 50], [20, 25, 60, 70]], dtype=np.float32),
    'area': np.array([900.0, 1400.0], dtype=np.float32),
}

ARGS = {
    'image': image,
    'target': target,
    'size': 200,
    'max_size': 400,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — 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
dres_dwh Not yet run
unverified (harvested, no recorded run)
linxid/Focus-DETR/models/focus_detr/grad_ops.py
code served (permissive licence) · get_code("f111786e2550d75b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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 2 other papers
2 dated earlier
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
box_xyxy_to_cxcywh 2 other papers
2 dated earlier
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
area_box_grad 1 other paper
1 dated earlier
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
box_xyxy_to_xywh 1 other paper
1 dated earlier
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
dres_dwh 1 other paper
1 dated earlier
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
grad_xywh_to_cxcy 1 other paper
1 dated earlier
2005.12872 (2020-05)
End-to-End Object Detection with Transformers

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

DETR-like models have significantly boosted the performance of detectors and even outperformed classical convolutional models. However, all tokens are treated equally without discrimination brings a redundant computational burden in the traditional encoder structure. The recent sparsification strategies exploit a subset of informative tokens to reduce attention complexity maintaining performance through the sparse encoder. But these methods tend to rely on unreliable model statistics. Moreover, simply reducing the token population hinders the detection performance to a large extent, limiting the application of these sparse models. We propose Focus-DETR, which focuses attention on more informative tokens for a better trade-off between computation efficiency and model accuracy. Specifically, we reconstruct the encoder with dual attention, which includes a token scoring mechanism that considers both localization and category semantic information of the objects from multi-scale feature maps. We efficiently abandon the background queries and enhance the semantic interaction of the fine-grained object queries based on the scores. Compared with the state-of-the-art sparse DETR-like detectors under the same setting, our Focus-DETR gets comparable complexity while achieving 50.4AP (+2.2) on COCO. The code is available at https://github.com/huawei-noah/noah-research/tree/master/Focus-DETR and https://gitee.com/mindspore/models/tree/master/research/cv/Focus-DETR.

For agents

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

get_harvested_code_for_paper("2307.12612")
get_code_for_paper("2307.12612")
have("2307.12612")

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

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

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

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

Connect an agent — have() is free.