SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2401.14832 · AAAI · 2024

Text Image Inpainting via Global Structure-Guided Diffusion Models

Hui Xue, Pengfei Fang, Qiang Xu, Shipeng Zhu, Zuoyan Zhao, Chenjie Zhu

arXiv · PDF · Open in the Atlas

Code that ran

4 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 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; 0 failures of our instrument; 7 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/2401.14832.json · badge: /api/ran/2401.14832.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
blackprotoss/GSDM community
Papers with Code archive
4 ran · 7 no recorded run
FunctionStatusWhere it lives
BaseModel Ran
ran on a synthesized input · constructed an object; no result was computed
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("ae0ed693b569f627")
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, BaseModel: 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
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal config dict
opt = {
    'gpu_ids': None,  # CPU only
}

ARGS = {
    'opt': opt,
}
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 BaseModel — 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 BaseModel 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
Conv_bn_block Ran
ran on a synthesized input
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("17605665a45a8b50")
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 4, 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
import numpy as np

# INIT_ARGS: parameters for Conv_bn_block.__init__
# The __init__ takes *args and **kwargs that are passed to Conv2d
# We need: in_channels, out_channels, kernel_size at minimum
# BatchNorm2d needs out_channels from kwargs
INIT_ARGS = {
    'in_channels': 3,
    'out_channels': 8,
    'kernel_size': 3,
    'stride': 1,
    'padding': 1
}

# ARGS: parameters for the forward method
# forward(self, input) takes an input tensor
# Input shape should be (batch, in_channels, height, width)
ARGS = {
    'input': torch.randn(2, 3, 16, 12)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, 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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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)
Res_block Ran
ran on a synthesized input · constructed an object; no result was computed
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("80e7e021706c3f2b")
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, Res_block: 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

torch.manual_seed(0)

ARGS = {
    "in_channels": 4,
    "cnum": 8,
}

# Verify the module can be instantiated and forward pass works
model = torch.nn.Module.__new__(type('Res_block', (torch.nn.Module,), {}))
model.__dict__.update(torch.nn.Module().__dict__)

# Build a proper instance
model = type('Res_block', (torch.nn.Module,), {
    '__init__': lambda self, in_channels, cnum: (
        torch.nn.Module.__init__(self),
        setattr(self, '_conv1', torch.nn.Conv2d(in_channels, cnum, kernel_size=3, stride=1, padding=2, dilation=2)),
        setattr(self, '_conv2', torch.nn.Conv2d(cnum, cnum, kernel_size=3, stride=1, padding=2, dilation=2)),
        setattr(self, '_conv3', torch.nn.Conv2d(cnum, in_channels, kernel_size=3, stride=1, padding=2, dilation=2)),
        setattr(self, '_bn', torch.nn.BatchNorm2d(in_channels))
    )[-1],
    'forward': lambda self, x: (
        (xin := x),
        (x := torch.nn.functional.elu(self._conv1(x), alpha=1)),
        (x := torch.nn.functional.elu(self._conv2(x), alpha=1)),
        (x := self._conv3(x)),
        (x := torch.add(xin, x)),
        (x := torch.nn.functional.elu(self._bn(x), alpha=1)),
        x
    )[-1]
})(ARGS["in_channels"], ARGS["cnum"])

# Test with a small input tensor
test_input = torch.randn(2, ARGS["in_channels"], 4, 3)
test_output = model(test_input)

ARGS = {
    "in_channels": 4,
    "cnum": 8,
}
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 Res_block — 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 Res_block 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
SPM Ran
ran on a synthesized input · constructed an object; no result was computed
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("6c3d3d8b4a1de911")
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, SPM: 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

torch.manual_seed(0)

# SPM requires:
# - in_channels: int (number of input channels)
# - cum: int (channel multiplier, used as cnum)
# - get_feature_map: bool (whether to return feature maps)

# Looking at the forward method, the input x should be a 4D tensor
# with shape (batch, in_channels, height, width)

# Create a small input tensor for testing
batch_size = 2
in_channels = 3
height = 8
width = 8

input_tensor = torch.randn(batch_size, in_channels, height, width)

ARGS = {
    'in_channels': 3,
    'cum': 4,
    'get_feature_map': False
}
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 SPM — 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 SPM 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
DDPM Not yet run
unverified (harvested, no recorded run)
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("ec6180301c84d572")
How it ran

no invocation recorded.

GSDM Not yet run
unverified (harvested, no recorded run)
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("8be0463898a217a2")
How it ran

no invocation recorded.

define_G Not yet run
unverified (harvested, no recorded run)
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("92dfbdb3fa59745e")
How it ran

no invocation recorded.

init_weights Not yet run
unverified (harvested, no recorded run)
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("3d9b1d0b93e94962")
How it ran

no invocation recorded.

weights_init_kaiming Not yet run
unverified (harvested, no recorded run)
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("26ac90bf0df6c22e")
How it ran

no invocation recorded.

weights_init_normal Not yet run
unverified (harvested, no recorded run)
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("e458d481e772f2a0")
How it ran

no invocation recorded.

weights_init_orthogonal Not yet run
unverified (harvested, no recorded run)
blackprotoss/GSDM/model/model.py
code served (permissive licence) · get_code("b61e63d89ec6d881")
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, 0 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
init_weights
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2302.03018 (2023-02)
DDM2: Self-Supervised Diffusion MRI Denoising with Generative Diffusion Models
weights_init_kaiming
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2302.03018 (2023-02)
DDM2: Self-Supervised Diffusion MRI Denoising with Generative Diffusion Models
weights_init_normal
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2302.03018 (2023-02)
DDM2: Self-Supervised Diffusion MRI Denoising with Generative Diffusion Models
weights_init_orthogonal
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2302.03018 (2023-02)
DDM2: Self-Supervised Diffusion MRI Denoising with Generative Diffusion Models

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

Real-world text can be damaged by corrosion issues caused by environmental or human factors, which hinder the preservation of the complete styles of texts, e.g., texture and structure. These corrosion issues, such as graffiti signs and incomplete signatures, bring difficulties in understanding the texts, thereby posing significant challenges to downstream applications, e.g., scene text recognition and signature identification. Notably, current inpainting techniques often fail to adequately address this problem and have difficulties restoring accurate text images along with reasonable and consistent styles. Formulating this as an open problem of text image inpainting, this paper aims to build a benchmark to facilitate its study. In doing so, we establish two specific text inpainting datasets which contain scene text images and handwritten text images, respectively. Each of them includes images revamped by real-life and synthetic datasets, featuring pairs of original images, corrupted images, and other assistant information. On top of the datasets, we further develop a novel neural framework, Global Structure-guided Diffusion Model (GSDM), as a potential solution. Leveraging the global structure of the text as a prior, the proposed GSDM develops an efficient diffusion model to recover clean texts. The efficacy of our approach is demonstrated by thorough empirical study, including a substantial boost in both recognition accuracy and image quality. These findings not only highlight the effectiveness of our method but also underscore its potential to enhance the broader field of text image understanding and processing. Code and datasets are available at: https://github.com/blackprotoss/GSDM.

For agents

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

get_harvested_code_for_paper("2401.14832")
get_code_for_paper("2401.14832")
have("2401.14832")

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

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

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

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

Connect an agent — have() is free.