SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 05117 · ECCV · 2024

TransFusion -A Transparency-Based Diffusion Model for Anomaly Detection

Matic Fučka, Vitjan Zavrtanik, Danijel Skočaj

Open in the Atlas

Code that ran

10 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; 1 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 1 failure of our instrument; 2 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/05117.json · badge: /api/ran/05117.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
MaticFuc/ECCV_TransFusion canonical (classifier label)
classifier basis: census
10 ran · 2 no recorded run
FunctionStatusWhere it lives
gather Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
MaticFuc/ECCV_TransFusion/model/TransFusion.py
code served (permissive licence) · get_code("a77eeeca3b6710fd")
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 (8, 1, 1, 1) 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)

# The function gathers from c using indices t, then reshapes to (-1, 1, 1, 1)
# c needs to be a tensor that supports .gather(-1, t)
# t needs to be a tensor of indices

# Create a small tensor c with shape (2, 4) - batch size 2, feature dim 4
c = torch.randn(2, 4)

# Create indices tensor t with shape (2, 4) for gathering along last dimension
# Values should be valid indices (0-3 for dim of size 4)
t = torch.tensor([[0, 1, 2, 3], [1, 2, 3, 0]], dtype=torch.long)

ARGS = {
    "c": c,
    "t": t
}
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 (8, 1, 1, 1) — shape (8, 1, 1, 1) 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
gaussian Ran
ran, honoured the contract we drafted
MaticFuc/ECCV_TransFusion/utils/MathUtils.py
pointer only (licence: MIT); the stored copy get_code serves, from JS-CHU/RoamScene3D, is pointer only (licence: NONE) · get_code("e2424ce033ba3a0f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from JS-CHU/RoamScene3D, and GitHub detected no licence in that repository when it was checked. 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.

get_depth_files Ran
ran on a synthesized input
MaticFuc/ECCV_TransFusion/dataset/Dataset.py
code served (permissive licence) · get_code("34779369df3ec78b")
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 os
import tempfile
import glob

# Create a temporary directory structure to simulate the expected file paths
temp_dir = tempfile.mkdtemp()

# Create subdirectories for test=True case (*/xyz/*.tiff pattern)
test_subdir1 = os.path.join(temp_dir, "subdir1", "xyz")
test_subdir2 = os.path.join(temp_dir, "subdir2", "xyz")
os.makedirs(test_subdir1, exist_ok=True)
os.makedirs(test_subdir2, exist_ok=True)

# Create dummy .tiff files in the test subdirectories
open(os.path.join(test_subdir1, "depth1.tiff"), 'w').close()
open(os.path.join(test_subdir1, "depth2.tiff"), 'w').close()
open(os.path.join(test_subdir2, "depth3.tiff"), 'w').close()

# Create xyz subdirectory at root level for test=False case
xyz_dir = os.path.join(temp_dir, "xyz")
os.makedirs(xyz_dir, exist_ok=True)

# Create dummy .tiff files in the root xyz directory
open(os.path.join(xyz_dir, "depth4.tiff"), 'w').close()
open(os.path.join(xyz_dir, "depth5.tiff"), 'w').close()

ARGS = {
    "test": True,
    "path": temp_dir
}
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
get_faulty_imgs Ran
ran on a synthesized input
MaticFuc/ECCV_TransFusion/dataset/Dataset.py
code served (permissive licence) · get_code("c34437aa0f4048ee")
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 1, dtype family float, shape (1,) 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 cv2
import numpy as np
import tempfile
import os

# Create temporary directory and mock image files
tmpdir = tempfile.mkdtemp()

# Create mock mask files for 'visa' dataset
visa_test_file = os.path.join(tmpdir, 'test_image.JPG')
visa_mask_file = os.path.join(tmpdir, 'ground_truth_image.png')

# Write dummy image files
dummy_mask = (np.random.rand(10, 10) * 255).astype(np.uint8)
cv2.imwrite(visa_mask_file, dummy_mask)

# Create mock mask files for 'mvtec' dataset
mvtec_test_file = os.path.join(tmpdir, 'test_image.png')
mvtec_mask_file = os.path.join(tmpdir, 'ground_truth_image_mask.png')
cv2.imwrite(mvtec_mask_file, dummy_mask)

# Create mock mask files for 'mvtec3d' dataset
mvtec3d_rgb_file = os.path.join(tmpdir, 'rgb_image.png')
mvtec3d_gt_file = os.path.join(tmpdir, 'gt_image.png')
cv2.imwrite(mvtec3d_gt_file, dummy_mask)

# Test with visa dataset
ARGS = {
    'dataset': 'visa',
    'files': [visa_test_file]
}
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 ndarray, ndim 1, dtype family float, shape (1,) — shape (1,) 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
get_files Ran
ran on a synthesized input
MaticFuc/ECCV_TransFusion/dataset/Dataset.py
code served (permissive licence) · get_code("8989f4ebbe3c29ca")
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, ndim 2, 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 tempfile
import os
import cv2
import numpy as np

# Create temporary directory structure for testing
temp_dir = tempfile.mkdtemp()

# Create mock dataset structure for 'visa'
visa_test_dir = os.path.join(temp_dir, 'visa_test', 'category1')
os.makedirs(visa_test_dir, exist_ok=True)

# Create a test image file
test_img_path = os.path.join(visa_test_dir, 'test_image.JPG')
test_img = np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8)
cv2.imwrite(test_img_path, test_img)

# Create corresponding ground truth mask
gt_mask_path = os.path.join(temp_dir, 'visa_test', 'category1', 'test_image.png')
mask = np.ones((100, 100), dtype=np.uint8) * 255
cv2.imwrite(gt_mask_path, mask)

# Create another test case with empty mask (faulty)
test_img_path_2 = os.path.join(visa_test_dir, 'test_image_2.JPG')
test_img_2 = np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8)
cv2.imwrite(test_img_path_2, test_img_2)

gt_mask_path_2 = os.path.join(visa_test_dir, 'test_image_2.png')
empty_mask = np.zeros((100, 100), dtype=np.uint8)
cv2.imwrite(gt_mask_path_2, empty_mask)

ARGS = {
    'dataset': 'visa',
    'test': True,
    'path': visa_test_dir
}
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, ndim 2, dtype family float — a tuple 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
get_optimizer Ran
ran on a synthesized input
MaticFuc/ECCV_TransFusion/utils/ParsingUtils.py
code served (permissive licence) · get_code("b9bbd6fbc0ace0c4")
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 AdamW. 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
import torch.nn as nn
import torch.optim as optim

torch.manual_seed(0)

# Build a minimal neural network
class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create instances
net = SimpleNet()

# Create args object with required attributes
class Args:
    def __init__(self):
        self.lr = 0.001

args = Args()

# Define ARGS dictionary
ARGS = {
    'args': args,
    'net': net
}
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 AdamW — a AdamW output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AdamW 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
get_scheduler Ran
ran on a synthesized input
MaticFuc/ECCV_TransFusion/utils/ParsingUtils.py
code served (permissive licence) · get_code("7cf014178dd0501c")
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 StepLR. 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
import torch.nn as nn

torch.manual_seed(0)

# Create a simple model
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

# Create args object with required attributes
class Args:
    def __init__(self):
        self.step_size = 10
        self.gamma = 0.1

args = Args()

# Define ARGS dict mapping every parameter
ARGS = {
    "args": args,
    "optimizer": optimizer
}
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 StepLR — a StepLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a StepLR 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
gkern Ran
ran on a synthesized input
MaticFuc/ECCV_TransFusion/utils/MathUtils.py
code served (permissive licence) · get_code("0fb56aef6a483f6b")
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 (5, 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 numpy as np

ARGS = {
    'l': 5,
    'sig': 1.0,
}
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 (5, 5) — shape (5, 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
normalize Ran
ran on a synthesized input
MaticFuc/ECCV_TransFusion/utils/EvaluationUtils.py
code served (permissive licence) · get_code("1c96b7768708cd50")
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, 3, 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)

# The function expects a tensor x with:
# - x.shape[0] (batch dimension) that can be compared to 1
# - x[:3, :, :] indexing (at least 3 channels in first dimension)
# - Operations: division, addition, clipping
# Create a tensor with shape (batch=2, channels=4, height=3, width=3)
# This has at least 3 channels and allows indexing x[:3, :, :]

x = torch.randn(2, 4, 3, 3)

ARGS = {
    "x": x
}
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, 3, 3) — shape (2, 4, 3, 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
rand_perlin_2d Ran
ran on a synthesized input
MaticFuc/ECCV_TransFusion/utils/MathUtils.py
code served (permissive licence) · get_code("9495ffdc403faa4a")
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 2, dtype family float, shape (8, 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 math
import torch

torch.manual_seed(0)

# Construct arguments for rand_perlin_2d
shape = (8, 12)  # Output shape
res = (4, 6)     # Resolution for grid

ARGS = {
    "shape": shape,
    "res": res,
}
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 2, dtype family float, shape (8, 12) — shape (8, 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
calculate_transfussion_results Not yet run
unverified (harvested, no recorded run)
MaticFuc/ECCV_TransFusion/utils/EvaluationUtils.py
code served (permissive licence) · get_code("05455fe977a7c203")
How it ran

no invocation recorded.

get_transparentfussion_sample Not yet run
unverified (harvested, no recorded run)
MaticFuc/ECCV_TransFusion/utils/EvaluationUtils.py
code served (permissive licence) · get_code("49ff64d8c857f4d1")
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, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 10 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
gaussian 160 other papers
64 dated earlier, 19 later, 77 same year, order not determinable · 7 only as an assembly brick
1812.11941 (2018-12)
High Quality Monocular Depth Estimation via Transfer Learning
1904.01538 (2019-04)
Spatial Attentive Single-Image Deraining with a High Quality Real Rain Dataset
1907.11628 (2019-07)
Unsupervised Learning for Optical Flow Estimation Using Pyramid Convolution LSTM
and 157 more not named here
gather 1 other paper
1 dated earlier
2311.09999 (2023-11)
TransFusion -- A Transparency-Based Diffusion Model for Anomaly Detection

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

Surface anomaly detection is a vital component in manufacturing inspection. Current discriminative methods follow a two-stage architecture composed of a reconstructive network followed by a discriminative network that relies on the reconstruction output. Currently used reconstructive networks often produce poor reconstructions that either still contain anomalies or lack details in anomaly-free regions. Discriminative methods are robust to some reconstructive network failures, suggesting that the discriminative network learns a strong normal appearance signal that the reconstructive networks miss. We reformulate the two-stage architecture into a single-stage iterative process that allows the exchange of information between the reconstruction and localization. We propose a novel transparency-based diffusion process where the transparency of anomalous regions is progressively increased, restoring their normal appearance accurately while maintaining the appearance of anomaly-free regions using localization cues of previous steps. We implement the proposed process as TRANSparency DifFU-SION (TransFusion), a novel discriminative anomaly detection method that achieves state-of-the-art performance on both the VisA and the MVTec AD datasets, with an image-level AUROC of 98.5% and 99.2%, respectively. Code: https://github.com/MaticFuc/ECCV_TransFusion

For agents

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

get_harvested_code_for_paper("05117")
get_code_for_paper("05117")
have("05117")

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

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

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

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

Connect an agent — have() is free.