SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2609.02348 · September 2026

Structured-Prior-Guided Diffusion Inpainting with Physical Consistency for Traffic Sign Augmentation

Qiang Gao, Jun Jia, Xinlong Liu, Luo Li, Chongchong Huang, Gui Yang, Liang Cao

arXiv · PDF · Open in the Atlas

Code that ran

6 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/2609.02348.json · badge: /api/ran/2609.02348.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
52hz-whale/TrafficSignInpaint canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
FunctionStatusWhere it lives
case_name Ran
ran; our contract draft was wrong, not the code
52hz-whale/TrafficSignInpaint/src/infer.py
code served (permissive licence) · get_code("f5a83632c8892563")
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 json

def case_name(line_idx, prompt_text):
    """`{idx}.png` for warning signs, `{idx}_{value}.png` for speed-limit signs."""
    type_info = json.loads(prompt_text)
    if type_info.get('info'):
        return f"{line_idx}_{type_info['info']}.png"
    return f'{line_idx}.png'

# Test case 1: prompt_text with 'info' field
prompt_with_info = json.dumps({"info": "speed_limit_50"})

# Test case 2: prompt_text without 'info' field
prompt_without_info = json.dumps({"type": "warning"})

ARGS = {
    "line_idx": 42,
    "prompt_text": prompt_with_info
}
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
circle_2_ellipse_by_major_axis Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
52hz-whale/TrafficSignInpaint/src/dataset.py
code served (permissive licence) · get_code("b0c52130f8adecba")
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 3, dtype family int, shape (512, 512, 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 base64, cv2, zlib, pickle, torch, json
import numpy as np

# Create a small 512x512 image (grayscale or RGB)
img = np.random.randint(0, 256, (512, 512, 3), dtype=np.uint8)

# Create an ellipse tuple: (center, (width, height), angle)
ellipse = ((256.0, 256.0), (100.0, 50.0), 45.0)

ARGS = {
    "img": img,
    "ellipse": ellipse,
}
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 3, dtype family int, shape (512, 512, 3) — shape (512, 512, 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_array_from_json Ran
ran, honoured the contract we drafted
52hz-whale/TrafficSignInpaint/src/dataset.py
code served (permissive licence) · get_code("0591f915b19bf855")
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 base64
import zlib
import pickle
import torch
import numpy as np

# Create a small numpy array
original_array = np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.float32)

# Encode it using the same process that decode_array_from_json expects
data = original_array.tobytes()
compressed_data = zlib.compress(data)
encoded_data = base64.b64encode(compressed_data).decode('utf-8')

# Create the obj dict that decode_array_from_json expects
obj = {
    'data': encoded_data,
    'dtype': str(original_array.dtype),
    'shape': original_array.shape
}

ARGS = {
    'obj': obj
}
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, 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
pred_original_sample_train Ran
ran; our contract draft was wrong, not the code
52hz-whale/TrafficSignInpaint/src/loss.py
code served (permissive licence) · get_code("ef963e52ba11593e")
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, 64, 64) 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)

# Create a minimal noise scheduler config and scheduler
class MinimalNoiseSchedulerConfig:
    def __init__(self):
        self.prediction_type = 'epsilon'

class MinimalNoiseScheduler:
    def __init__(self):
        self.config = MinimalNoiseSchedulerConfig()
        # Create alphas_cumprod with 1000 timesteps (standard for diffusion)
        # Values should decrease from 1.0 to near 0
        self.alphas_cumprod = torch.linspace(1.0, 0.01, 1000)

# Create the noise scheduler
noise_scheduler = MinimalNoiseScheduler()

# Create timesteps tensor [B] with batch size 2
# Values should be valid indices into alphas_cumprod (0-999)
timesteps = torch.tensor([10, 50], dtype=torch.long)

# Create sample tensor [B, 4, 64, 64] - batch_size=2, channels=4, spatial=64x64
sample = torch.randn(2, 4, 64, 64)

# Create model_output tensor with same shape as sample [B, 4, 64, 64]
model_output = torch.randn(2, 4, 64, 64)

ARGS = {
    'noise_scheduler': noise_scheduler,
    'model_output': model_output,
    'timesteps': timesteps,
    'sample': sample
}
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, 64, 64) — shape (2, 4, 64, 64) 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
random_crop_around_bbox Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
52hz-whale/TrafficSignInpaint/data_processing/step1_crop.py
code served (permissive licence) · get_code("7bea847972399edd")
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
import random

# Set seed for reproducibility
random.seed(42)
np.random.seed(42)

# Create a minimal test image (300x400 with 3 channels, typical CV2 format)
# Using uint8 dtype like cv2.imread would return
img_cv2 = np.random.randint(0, 256, size=(300, 400, 3), dtype=np.uint8)

# Create a bounding box that's well within the image
# bbox format: {'xmin': float, 'ymin': float, 'xmax': float, 'ymax': float}
# Place it roughly in the center with reasonable size
bbox = {
    'xmin': 150.0,
    'ymin': 100.0,
    'xmax': 200.0,
    'ymax': 140.0
}

ARGS = {
    'img_cv2': img_cv2,
    'bbox': bbox
}
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
sort_triangle_points Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
52hz-whale/TrafficSignInpaint/src/dataset.py
code served (permissive licence) · get_code("26192dc54b6808e1")
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 (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 numpy as np

# The function takes a 'points' parameter which should be a list/array of 3 points
# Each point should be a coordinate pair (x, y)
# The function sorts them and returns them in a specific order

# Create 3 distinct points as tuples
point1 = (2.0, 5.0)  # This will be the top (highest y)
point2 = (1.0, 1.0)  # This will be left bottom (lowest x among bottom two)
point3 = (4.0, 1.0)  # This will be right bottom (highest x among bottom two)

points = [point1, point2, point3]

ARGS = {
    "points": points
}
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 (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: none by the harness; any seed is in the setup block
check_digit_font Not yet run
unverified (harvested, no recorded run)
52hz-whale/TrafficSignInpaint/src/config.py
code served (permissive licence) · get_code("3f86291b18155c3e")
How it ran

no invocation recorded.

combined_edge_color_loss Not yet run
unverified (harvested, no recorded run)
52hz-whale/TrafficSignInpaint/src/loss.py
code served (permissive licence) · get_code("6f58066a6cac1d73")
How it ran

no invocation recorded.

extract_sign_colors Not yet run
unverified (harvested, no recorded run)
52hz-whale/TrafficSignInpaint/data_processing/color_estimate.py
code served (permissive licence) · get_code("55df6c2d2670f308")
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, 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 9 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-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Traffic sign detection faces a long-tailed data distribution. Many rare signs matter as much as common ones from a regulatory standpoint, yet they have very few samples. Generative data augmentation is one way out. General-purpose inpainting models, however, distort digits, deform geometry and perspective, and shift colours when applied directly to sign regions. We trace this to a single gap: the conditioning signal is too abstract for the physical composition of a sign. We propose a structured-prior-guided diffusion inpainting framework with physical consistency. It injects the semantic, appearance and geometric priors of a sign through three orthogonal pathways: a JSON-formatted text prompt, a front-view vector template rendered with measured dominant colours (via IP-Adapter), and an affine-aligned vector template (via ControlNet). Two physical consistency losses constrain colour with a CIELAB chromaticity $L_1$ term and edge structure with a Sobel gradient term. We train by self-supervised reconstruction on a large set of images collected in-house at AMAP, then evaluate zero-shot on the public TT100K-2021 dataset, a different source. Our method uses a Stable Diffusion 1.5 backbone of about 1.4B parameters. It beats seven representative competitors on every metric of reconstruction fidelity, physical consistency and semantic controllability. Its OCR exact-match rate reaches 91.1\%, against 44.2\% for the 12B industrial model FLUX.1 Fill [dev], and it needs only $1/14$ of that model's inference time. Leave-one-out ablations confirm that each of the three prior pathways and both loss terms contribute on their own. In downstream detection, the synthetic data raises the group-pooled AP50 of rare classes by $1.23\times$ to $7.40\times$ over a real-data-only baseline. Code and pre-trained models are available at https://github.com/52hz-whale/TrafficSignInpaint.

For agents

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

get_harvested_code_for_paper("2609.02348")
get_code_for_paper("2609.02348")
have("2609.02348")

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

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

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

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

Connect an agent — have() is free.