SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_27844 · AAAI · 2024

SRFormer: Text Detection Transformer with Incorporated Segmentation and Regression

Sungrae Park, Qingwen Bu, Minsoo Khang, Yichuan Cheng

Open in the Atlas

Code that ran

10 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 6 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/aaai_27844.json · badge: /api/ran/aaai_27844.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
retsuh-bqw/SRFormer-Text-Det canonical (classifier label)
classifier basis: census
10 ran · 1 no recorded run
FunctionStatusWhere it lives
calculate_uncertainty Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
retsuh-bqw/SRFormer-Text-Det/adet/modeling/srformer/losses.py
code served (permissive licence) · get_code("2dcb8123d89bb1ff")
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, 1, 4, 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)

# logits should be a tensor of shape (R, 1, ...) where R is number of predictions
# The function expects logits.shape[1] == 1
# Let's create a tensor with shape (2, 1, 4, 3) - R=2, C=1, and spatial dims 4x3
logits = torch.randn(2, 1, 4, 3)

ARGS = {
    "logits": logits
}
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, 1, 4, 3) — shape (2, 1, 4, 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
decode_utf8 Ran
ran on a synthesized input
retsuh-bqw/SRFormer-Text-Det/adet/evaluation/rrc_evaluation_funcs_det.py
code served (permissive licence) · get_code("45a55fb067e4b050")
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 codecs

ARGS = {
    "raw": b"Hello, World!"
}
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
dice_loss Ran
ran on a synthesized input
retsuh-bqw/SRFormer-Text-Det/adet/modeling/srformer/matcher.py
code served (permissive licence) · get_code("9b4101618aa236a1")
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 float, shape (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)

# Create small tensors for inputs and targets
# inputs: predictions (float tensor of arbitrary shape)
# targets: binary labels (same shape as inputs, values 0 or 1)
batch_size = 2
feature_dim = 4

inputs = torch.randn(batch_size, feature_dim, dtype=torch.float32)
targets = torch.randint(0, 2, (batch_size, feature_dim), dtype=torch.float32)

ARGS = {
    "inputs": inputs,
    "targets": targets,
}
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 1, dtype family float, 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
gen_point_pos_embed Ran
ran on a synthesized input
retsuh-bqw/SRFormer-Text-Det/adet/modeling/srformer/utils.py
code served (permissive licence) · get_code("cbd15130966eeed7")
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, 3, 4, 256) 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 math

torch.manual_seed(0)

# Construct a small tensor with shape (batch=2, height=3, width=4, coords=2)
# The last dimension contains (x, y) coordinates
pts_tensor = torch.randn(2, 3, 4, 2, dtype=torch.float32)

ARGS = {
    "pts_tensor": pts_tensor
}
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, 3, 4, 256) — shape (2, 3, 4, 256) 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
inverse_sigmoid Ran
ran; our contract draft was wrong, not the code
retsuh-bqw/SRFormer-Text-Det/adet/modeling/srformer/utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from woodfrog/poly-diffuse, is pointer only (licence: GPL-3.0) · get_code("83c03ceb1307c6c4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from woodfrog/poly-diffuse, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. 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.

load_zip_file Ran
ran on a synthesized input
retsuh-bqw/SRFormer-Text-Det/adet/evaluation/rrc_evaluation_funcs_det.py
code served (permissive licence) · get_code("7c5e8c6d736c8bc0")
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 dict. 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 zipfile
import io
import re

# Create a valid ZIP file in memory
zip_buffer = io.BytesIO()
with zipfile.ZipFile(zip_buffer, 'w') as zf:
    zf.writestr('file1.txt', b'content1')
    zf.writestr('file2.txt', b'content2')
    zf.writestr('data_001.dat', b'data_content_1')
    zf.writestr('data_002.dat', b'data_content_2')

zip_buffer.seek(0)

ARGS = {
    'file': zip_buffer,
    'fileNameRegExp': r'data_(\d+)\.dat',
    'allEntries': False
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
load_zip_file_keys Ran
ran on a synthesized input
retsuh-bqw/SRFormer-Text-Det/adet/evaluation/rrc_evaluation_funcs_det.py
code served (permissive licence) · get_code("0757665b07dbdf97")
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 list, ndim 1, 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 io
import zipfile
import tempfile
import os

# Create a temporary ZIP file in memory
zip_buffer = io.BytesIO()
with zipfile.ZipFile(zip_buffer, 'w', zipfile.ZIP_DEFLATED) as zf:
    zf.writestr('file1.txt', 'content1')
    zf.writestr('file2.txt', 'content2')
    zf.writestr('data_001_model.pkl', 'model_data')
    zf.writestr('data_002_model.pkl', 'model_data2')
    zf.writestr('readme.md', 'readme content')

zip_buffer.seek(0)

ARGS = {
    'file': zip_buffer,
    'fileNameRegExp': ''
}
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 list, ndim 1, dtype family float — a list 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
ms_deform_attn_core_pytorch Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
retsuh-bqw/SRFormer-Text-Det/adet/layers/ms_deform_attn.py
code served (permissive licence) · get_code("c53ec291fabfc643")
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 3, dtype family float, shape (2, 5, 12) 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)

# Dimensions:
# N_ = batch size (2)
# S_ = total spatial positions (12)
# M_ = number of heads (3)
# D_ = feature dimension (4)
# Lq_ = query length (5)
# L_ = number of levels (2)
# P_ = number of sampling points (6)

N_ = 2
S_ = 12
M_ = 3
D_ = 4
Lq_ = 5
L_ = 2
P_ = 6

# value: [N_, S_, M_, D_]
value = torch.randn(N_, S_, M_, D_)

# value_spatial_shapes: list of (H_, W_) tuples for each level
# We need H_*W_ to sum to S_
# Level 0: 3x2=6, Level 1: 2x3=6, total=12
value_spatial_shapes = [(3, 2), (2, 3)]

# sampling_locations: [N_, Lq_, M_, L_, P_, 2]
# The last dimension is (x, y) coordinates
sampling_locations = torch.rand(N_, Lq_, M_, L_, P_, 2) * 0.5 + 0.25

# attention_weights: [N_, Lq_, M_, L_, P_]
attention_weights = torch.rand(N_, Lq_, M_, L_, P_)

ARGS = {
    "value": value,
    "value_spatial_shapes": value_spatial_shapes,
    "sampling_locations": sampling_locations,
    "attention_weights": attention_weights,
}
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 3, dtype family float, shape (2, 5, 12) — shape (2, 5, 12) 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
shrink_polygon_py Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
retsuh-bqw/SRFormer-Text-Det/adet/modeling/srformer/utils.py
code served (permissive licence) · get_code("749e3320d4df71f9")
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 (4, 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 numpy as np

torch.manual_seed(0)

# Create a small polygon as a numpy array with shape (4, 2)
# representing 4 points in 2D space
polygon = np.array([
    [0.0, 0.0],
    [4.0, 0.0],
    [4.0, 3.0],
    [0.0, 3.0]
], dtype=np.float32)

# Shrink ratio parameter
shrink_ratio = 0.8

ARGS = {
    "polygon": polygon,
    "shrink_ratio": shrink_ratio
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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 (4, 2) — shape (4, 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
sigmoid_ce_loss Ran
ran on a synthesized input
retsuh-bqw/SRFormer-Text-Det/adet/modeling/srformer/matcher.py
code served (permissive licence) · get_code("641305cea54a6936")
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 float, shape (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.functional as F

torch.manual_seed(0)

# Create small test tensors
# inputs: predictions (logits) from model
inputs = torch.randn(2, 4)

# targets: binary labels (0 or 1)
targets = torch.randint(0, 2, (2, 4)).float()

ARGS = {
    'inputs': inputs,
    'targets': targets,
}
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 1, dtype family float, 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
sigmoid_focal_loss Not yet run
unverified (harvested, no recorded run)
retsuh-bqw/SRFormer-Text-Det/adet/modeling/srformer/losses.py
code served (permissive licence) · get_code("47bae639172d422d")
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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 3 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
inverse_sigmoid 51 other papers
36 dated earlier, 4 later, 11 same year, order not determinable · 23 only as an assembly brick
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
2103.11161 (2021-03)
MonteFloor: Extending MCTS for Reconstructing Accurate Large-Scale Floor Plans
and 48 more not named here
calculate_uncertainty 34 other papers
21 dated earlier, 2 later, 11 same year, order not determinable
2112.01527 (2021-12)
Masked-attention Mask Transformer for Universal Image Segmentation
2112.10764 (2021-12)
Mask2Former for Video Instance Segmentation
2203.04187 (2022-03)
RankSeg: Adaptive Pixel Classification with Image Category Ranking for Segmentation
and 31 more not named here
ms_deform_attn_core_pytorch 6 other papers
3 dated earlier, 1 later, 2 same year, order not determinable · 1 only as an assembly brick
2107.14467 (2021-07)
DPT: Deformable Patch-based Transformer for Visual Recognition
2111.14330 (2021-11)
Sparse DETR: Efficient End-to-End Object Detection with Learnable Sparsity
2203.01305 (2022-03)
DN-DETR: Accelerate DETR Training by Introducing Query DeNoising
and 3 more not named here
shrink_polygon_py 1 other paper
1 dated earlier
1911.08947 (2019-11)
Real-time Scene Text Detection with Differentiable Binarization

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

Existing techniques for text detection can be broadly classified into two primary groups: segmentation-based and regression-based methods. Segmentation models offer enhanced robustness to font variations but require intricate post-processing, leading to high computational overhead. Regression-based methods undertake instance-aware prediction but face limitations in robustness and data efficiency due to their reliance on high-level representations. In our academic pursuit, we propose SRFormer, a unified DETR-based model with amalgamated Segmentation and Regression, aiming at the synergistic harnessing of the inherent robustness in segmentation representations, along with the straightforward post-processing of instance-level regression. Our empirical analysis indicates that favorable segmentation predictions can be obtained at the initial decoder layers. In light of this, we constrain the incorporation of segmentation branches to the first few decoder layers and employ progressive regression refinement in subsequent layers, achieving performance gains while minimizing computational load from the mask. Furthermore, we propose a Mask-informed Query Enhancement module. We take the segmentation result as a natural soft-ROI to pool and extract robust pixel representations, which are then employed to enhance and diversify instance queries. Extensive experimentation across multiple benchmarks has yielded compelling findings, highlighting our method's exceptional robustness, superior training and data efficiency, as well as its state-of-the-art performance. Our code is available at https://github.com/retsuh-bqw/SRFormer-Text-Det.

For agents

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

get_harvested_code_for_paper("aaai_27844")
get_code_for_paper("aaai_27844")
have("aaai_27844")

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

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

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

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

Connect an agent — have() is free.