SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2602.03013 · 2026

Thinking inside the Convolution for Image Inpainting: Reconstructing Texture via Structure under Global and Local Side

Yang Wang, Meng Wang, Yong Rui, Haipeng Liu, Biao Qian, Relu Conv, Qian, Global Relu, Conv Global, Ⅳ Reconstruction

arXiv · PDF

Code that ran

3 of 13 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 2 have no contract verdict; 1 failure of our instrument; 10 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/2602.03013.json · badge: /api/ran/2602.03013.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
htyjers/ConvInpaint-TSGL community
Papers with Code archive
3 ran · 10 no recorded run
FunctionStatusWhere it lives
ConcatTupleLayer Ran
ran on a synthesized input
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("4782bac67637ecbf")
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 (2, 7) 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 ConcatTupleLayer(nn.Module):

    def forward(self, x):
        assert isinstance(x, tuple)
        x_l, x_g = x
        assert torch.is_tensor(x_l) or torch.is_tensor(x_g)
        if not torch.is_tensor(x_g):
            return x_l
        return torch.cat(x, dim=1)


INIT_ARGS = {}

ARGS = {
    'x': (
        torch.randn(2, 4),
        torch.randn(2, 3)
    )
}

if __name__ == '__main__':
    layer = ConcatTupleLayer(**INIT_ARGS)
    output = layer(**ARGS)
    print("Output shape:", output.shape)
    print("Output:", 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 (2, 7) — shape (2, 7) 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)
FourierUnit Ran
ran on a synthesized input
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("5c5fd72a573dde5a")
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, shape (2, 8, 3, 5) 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
import torch.nn.functional as F

class SELayer(nn.Module):

    def __init__(self, channel, reduction=16):
        super(SELayer, self).__init__()
        self.avg_pool = nn.AdaptiveAvgPool2d(1)
        self.fc = nn.Sequential(nn.Linear(channel, channel // reduction, bias=False), nn.ReLU(inplace=True), nn.Linear(channel // reduction, channel, bias=False), nn.Sigmoid())

    def forward(self, x):
        b, c, _, _ = x.size()
        y = self.avg_pool(x).view(b, c)
        y = self.fc(y).view(b, c, 1, 1)
        res = x * y.expand_as(x)
        return res

class FourierUnit(nn.Module):

    def __init__(self, in_channels, out_channels, groups=1, spatial_scale_factor=None, spatial_scale_mode='bilinear', spectral_pos_encoding=False, use_se=False, se_kwargs=None, ffc3d=False, fft_norm='ortho'):
        super(FourierUnit, self).__init__()
        self.groups = groups
        self.conv_layer = torch.nn.Conv2d(in_channels=in_channels * 2 + (2 if spectral_pos_encoding else 0), out_channels=out_channels * 2, kernel_size=1, stride=1, padding=0, groups=self.groups, bias=False)
        self.bn = torch.nn.BatchNorm2d(out_channels * 2)
        self.relu = torch.nn.ReLU(inplace=True)
        self.use_se = use_se
        if use_se:
            if se_kwargs is None:
                se_kwargs = {}
            self.se = SELayer(self.conv_layer.in_channels, **se_kwargs)
        self.spatial_scale_factor = spatial_scale_factor
        self.spatial_scale_mode = spatial_scale_mode
        self.spectral_pos_encoding = spectral_pos_encoding
        self.ffc3d = ffc3d
        self.fft_norm = fft_norm

    def forward(self, x):
        batch = x.shape[0]
        if self.spatial_scale_factor is not None:
            orig_size = x.shape[-2:]
            x = F.interpolate(x, scale_factor=self.spatial_scale_factor, mode=self.spatial_scale_mode, align_corners=False)
        r_size = x.size()
        fft_dim = (-3, -2, -1) if self.ffc3d else (-2, -1)
        ffted = torch.fft.rfftn(x, dim=fft_dim, norm=self.fft_norm)
        ffted = torch.stack((ffted.real, ffted.imag), dim=-1)
        ffted = ffted.permute(0, 1, 4, 2, 3).contiguous()
        ffted = ffted.view((batch, -1) + ffted.size()[3:])
        if self.spectral_pos_encoding:
            height, width = ffted.shape[-2:]
            coords_vert = torch.linspace(0, 1, height)[None, None, :, None].expand(batch, 1, height, width).to(ffted)
            coords_hor = torch.linspace(0, 1, width)[None, None, None, :].expand(batch, 1, height, width).to(ffted)
            ffted = torch.cat((coords_vert, coords_hor, ffted), dim=1)
        if self.use_se:
            ffted = self.se(ffted)
        ffted = self.conv_layer(ffted)
        ffted = self.relu(self.bn(ffted))
        ffted = ffted.view((batch, -1, 2) + ffted.size()[2:]).permute(0, 1, 3, 4, 2).contiguous()
        ffted = torch.complex(ffted[..., 0], ffted[..., 1])
        ifft_shape_slice = x.shape[-3:] if self.ffc3d else x.shape[-2:]
        output = torch.fft.irfftn(ffted, s=ifft_shape_slice, dim=fft_dim, norm=self.fft_norm)
        if self.spatial_scale_factor is not None:
            output = F.interpolate(output, size=orig_size, mode=self.spatial_scale_mode, align_corners=False)
        return output

INIT_ARGS = {
    'in_channels': 4,
    'out_channels': 8,
    'groups': 1,
    'spatial_scale_factor': None,
    'spatial_scale_mode': 'bilinear',
    'spectral_pos_encoding': False,
    'use_se': False,
    'se_kwargs': None,
    'ffc3d': False,
    'fft_norm': 'ortho'
}

ARGS = {
    'x': torch.randn(2, 4, 3, 5)
}

if __name__ == '__main__':
    model = FourierUnit(**INIT_ARGS)
    model.eval()
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output dtype: {output.dtype}")
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 4, dtype family float, shape (2, 8, 3, 5) — shape (2, 8, 3, 5) 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)
PositionalNorm2d Ran
ran; our contract draft was wrong, not the code
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("9483a854e82aaba9")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 3, 5) 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)

# PositionalNorm2d expects:
# - x: a tensor with at least 2 dimensions (batch, channels, height, width for 2D)
#   The function calls x.mean(dim=1, keepdim=True) and x.var(dim=1, keepdim=True)
#   so dim=1 should be the channel dimension
# - epsilon: a small float for numerical stability

# Create a small 4D tensor (batch=2, channels=4, height=3, width=5)
x = torch.randn(2, 4, 3, 5)

# epsilon is optional with default value 1e-05
epsilon = 1e-05

ARGS = {
    "x": x,
    "epsilon": epsilon,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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, 3, 5) — shape (2, 4, 3, 5) 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
FFC Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("0a6713cf15b0772e")
How it ran

no invocation recorded.

FFCResNetGenerator Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("4ee289538fec4145")
How it ran

no invocation recorded.

FFCResnetBlock Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("1b506d732936d365")
How it ran

no invocation recorded.

FFC_BN_ACT Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("c094f5f943b8669f")
How it ran

no invocation recorded.

LearnableSpatialTransformWrapper Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("ab0fa05796d87851")
How it ran

no invocation recorded.

SPADE Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("77f3bddf0536c400")
How it ran

no invocation recorded.

SPDNormResnetBlock Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("bb554df0334a7a87")
How it ran

no invocation recorded.

SpectralTransform Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("e72d4cb7bfd9d6f4")
How it ran

no invocation recorded.

SynchronizedBatchNorm2d Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("f631155daea43fee")
How it ran

no invocation recorded.

_SynchronizedBatchNorm Not yet run
unverified (harvested, no recorded run)
htyjers/ConvInpaint-TSGL/TSGL_Lama/train/model.py
code served (permissive licence) · get_code("a8598a998832faad")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 9 are also present in other papers whose code we hold (9 with at least one paper dated earlier, 0 the same month, 0 later) and 4 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
SynchronizedBatchNorm2d
brick of this paper's assembly: helper
12 other papers
12 dated earlier · 8 only as an assembly brick
1802.02611 (2018-02)
Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation
2101.10979 (2021-01)
Prototypical Pseudo Label Denoising and Target Structure Learning for Domain Adaptive Semantic Segmentation
2102.09896 (2021-02)
Scribble-Supervised Semantic Segmentation by Uncertainty Reduction on Neural Representation and Self-Supervision on Neural Eigenspace
and 9 more not named here
FFC
brick of this paper's assembly: model
3 other papers
3 dated earlier
2303.08524 (2023-03)
CoordFill: Efficient High-Resolution Image Inpainting via Parameterized Coordinate Querying
2405.05663 (2024-05)
RPBG: Towards Robust Neural Point-based Graphics in the Wild
2411.07231 (2024-11)
Watermark Anything with Localized Messages
LearnableSpatialTransformWrapper
brick of this paper's assembly: helper
2 other papers
2 dated earlier
2303.08524 (2023-03)
CoordFill: Efficient High-Resolution Image Inpainting via Parameterized Coordinate Querying
2411.07231 (2024-11)
Watermark Anything with Localized Messages
SpectralTransform
brick of this paper's assembly: model
2 other papers
2 dated earlier
2405.05663 (2024-05)
RPBG: Towards Robust Neural Point-based Graphics in the Wild
2411.07231 (2024-11)
Watermark Anything with Localized Messages
ConcatTupleLayer
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2303.08524 (2023-03)
CoordFill: Efficient High-Resolution Image Inpainting via Parameterized Coordinate Querying
FFCResnetBlock
brick of this paper's assembly: model
1 other paper
1 dated earlier
2411.07231 (2024-11)
Watermark Anything with Localized Messages
FFC_BN_ACT
brick of this paper's assembly: model
1 other paper
1 dated earlier
2411.07231 (2024-11)
Watermark Anything with Localized Messages
FourierUnit
brick of this paper's assembly: model
1 other paper
1 dated earlier
2411.07231 (2024-11)
Watermark Anything with Localized Messages
PositionalNorm2d
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2004.05571 (2020-04)
Cross-domain Correspondence Learning for Exemplar-based Image Translation

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

Image inpainting has earned substantial progress, owing to the encoder-and-decoder pipeline, which is benefited from the Convolutional Neural Networks (CNNs) with convolutional downsampling to inpaint the masked regions semantically from the known regions within the encoder, coupled with an upsampling process from the decoder for final inpainting output. Recent studies intuitively identify the high-frequency structure and low-frequency texture to be extracted by CNNs from the encoder, and subsequently for a desirable upsampling recovery. However, the existing arts inevitably overlook the information loss for both structure and texture feature maps during the convolutional downsampling process, hence suffer from a nonideal upsampling output. In this paper, we systematically answer whether and how the structure and texture feature map can mutually help to alleviate the information loss during the convolutional downsampling. Given the structure and texture feature maps, we adopt the statistical normalization and denormalization strategy for the reconstruction guidance during the convolutional downsampling process, and report the followings: 1) the structure feature map can well reconstruct the texture feature map rather than the inverse; 2) we further motivate the global and local residual structure feature maps, along with local and global texture normalization feature maps, while systematically claim that reconstructing texture feature map under global (local) normalization via global (local residual) structure feature map to be fused is the best for convolutions, as it can essentially alleviate the texture feature map loss via the reconstruction (denormalization) from structure feature map under both global and local side; 3) observing that reconstructing texture feature maps from global and local residual structure feature maps dominate at different stages, we balance the reconstruction over global and local texture feature maps via a cross-layer balance module for upsampling. The extensive experimental results validate its advantages to the state-of-the-arts over the images from low-tohigh resolutions including 256*256 and 512*512, especially holds by substituting all the encoders by ours. Our code is available at https://github.com/htyjers/ConvInpaint-TSGL.

For agents

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

get_harvested_code_for_paper("2602.03013")
get_code_for_paper("2602.03013")
have("2602.03013")

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

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

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

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

Connect an agent — have() is free.