SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.09359 · 2024

A Unified Anomaly Synthesis Strategy with Gradient Ascent for Industrial Anomaly Detection and Localization

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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; 2 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/2407.09359.json · badge: /api/ran/2407.09359.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
cqylunlun/glass canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_best_pr_re Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
cqylunlun/glass/metrics.py
code served (permissive licence) · get_code("445abda186be8f3e")
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 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 numpy as np

# Create sample data for anomaly detection task
# anomaly_ground_truth_labels: binary labels (0 or 1) indicating if sample is anomaly
# anomaly_prediction_weights: continuous scores/probabilities for anomaly predictions

# Create binary ground truth labels (0 = normal, 1 = anomaly)
anomaly_ground_truth_labels = np.array([0, 0, 1, 1, 0, 1, 0, 1])

# Create prediction weights/scores (continuous values, typically between 0 and 1)
anomaly_prediction_weights = np.array([0.1, 0.2, 0.8, 0.9, 0.3, 0.7, 0.15, 0.85])

ARGS = {
    "anomaly_ground_truth_labels": anomaly_ground_truth_labels,
    "anomaly_prediction_weights": anomaly_prediction_weights,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
compute_imagewise_retrieval_metrics Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
cqylunlun/glass/metrics.py
code served (permissive licence) · get_code("0ed340136461ba43")
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 torch
import numpy as np
from sklearn import metrics

torch.manual_seed(0)

# The function takes:
# 1. anomaly_prediction_weights: used as second arg to roc_auc_score and average_precision_score
#    These expect array-like of prediction scores
# 2. anomaly_ground_truth_labels: used as first arg to roc_auc_score and average_precision_score
#    These expect array-like of binary labels
# 3. path: string parameter, defaults to 'training'

# Create small valid inputs
anomaly_prediction_weights = np.array([0.1, 0.9, 0.3, 0.7, 0.2, 0.8])
anomaly_ground_truth_labels = np.array([0, 1, 0, 1, 0, 1])
path = 'training'

ARGS = {
    'anomaly_prediction_weights': anomaly_prediction_weights,
    'anomaly_ground_truth_labels': anomaly_ground_truth_labels,
    'path': path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — 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
compute_pixelwise_retrieval_metrics Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
cqylunlun/glass/metrics.py
code served (permissive licence) · get_code("b10a57e7570128c5")
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 numpy as np

# Create sample anomaly segmentations - can be list or array
# Using shape (2, 4, 3) - 2 samples, 4x3 pixel maps with anomaly scores
anomaly_segmentations = [
    np.random.rand(4, 3).astype(np.float32),
    np.random.rand(4, 3).astype(np.float32)
]

# Create sample ground truth masks - can be list or array
# Using shape (2, 4, 3) - 2 samples, 4x3 pixel maps with binary labels
ground_truth_masks = [
    np.random.randint(0, 2, size=(4, 3)).astype(np.int32),
    np.random.randint(0, 2, size=(4, 3)).astype(np.int32)
]

# Ensure we have at least some positive and negative samples for valid metrics
ground_truth_masks[0][0, 0] = 1
ground_truth_masks[0][1, 1] = 0
ground_truth_masks[1][2, 2] = 1

ARGS = {
    'anomaly_segmentations': anomaly_segmentations,
    'ground_truth_masks': ground_truth_masks,
    'path': 'test'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
create_storage_folder Ran
ran; our contract draft was wrong, not the code
cqylunlun/glass/utils.py
code served (permissive licence) · get_code("bd60fc834523d1a1")
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 os
import tempfile

ARGS = {
    'main_folder_path': tempfile.gettempdir(),
    'project_folder': 'test_project',
    'group_folder': 'test_group',
    'run_name': 'test_run',
    'mode': 'iterate'
}
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
lerp_np Ran
ran, honoured the contract we drafted
cqylunlun/glass/perlin.py
pointer only (licence: MIT); the stored copy get_code serves, from Chhro123/fast-foreground-aware-anomaly-synthesis, is pointer only (licence: NONE) · get_code("4de91a4627a51ea2")
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 Chhro123/fast-foreground-aware-anomaly-synthesis, 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.

set_torch_device Ran
ran; our contract draft was wrong, not the code
cqylunlun/glass/utils.py
code served (permissive licence) · get_code("61fd3c8459a48853")
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 device. 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)

# The function takes gpu_ids as a parameter
# It checks len(gpu_ids) and uses gpu_ids[0] if the list is non-empty
# We'll test with an empty list (CPU case)

ARGS = {
    'gpu_ids': []
}
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 device — a device output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a device 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
distribution_judge Not yet run
unverified (harvested, no recorded run)
cqylunlun/glass/utils.py
code served (permissive licence) · get_code("e7806e6d1dca9761")
How it ran

no invocation recorded.

load Not yet run
unverified (harvested, no recorded run)
cqylunlun/glass/backbones.py
code served (permissive licence) · get_code("c07c74fd129adbcc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 1 later) and 5 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
lerp_np 8 other papers
5 dated earlier, 3 later
Zavrtanik_DRAEM_-_A_Discriminatively_Trained_Reconstruction_Embedding_for_Surface_Anomaly_ICCV_2021_paper (2021 (year only))
DRAEM -A discriminatively trained reconstruction embedding for surface anomaly detection
2108.07610 (2021-08)
DRAEM -- A discriminatively trained reconstruction embedding for surface anomaly detection
2308.06748 (2023-08)
Target before Shooting: Accurate Anomaly Detection and Localization under One Millisecond via Cascade Patch Retrieval
and 5 more not named here
load 2 other papers
2 dated earlier
2106.08265 (2021-06)
Towards Total Recall in Industrial Anomaly Detection
2309.13226 (2023-09)
Real3D-AD: A Dataset of Point Cloud Anomaly Detection
set_torch_device 1 other paper
1 dated earlier
2106.08265 (2021-06)
Towards Total Recall in Industrial 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

Anomaly synthesis strategies can effectively enhance unsupervised anomaly detection. However, existing strategies have limitations in the coverage and controllability of anomaly synthesis, particularly for weak defects that are very similar to normal regions. In this paper, we propose Global and Local Anomaly co-Synthesis Strategy (GLASS), a novel unified framework designed to synthesize a broader coverage of anomalies under the manifold and hypersphere distribution constraints of Global Anomaly Synthesis (GAS) at the feature level and Local Anomaly Synthesis (LAS) at the image level. Our method synthesizes near-in-distribution anomalies in a controllable way using Gaussian noise guided by gradient ascent and truncated projection. GLASS achieves state-of-the-art results on the MVTec AD (detection AUROC of 99.9\%), VisA, and MPDD datasets and excels in weak defect detection. The effectiveness and efficiency have been further validated in industrial applications for woven fabric defect detection. The code and dataset are available at: \url{https://github.com/cqylunlun/GLASS}.

For agents

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

get_harvested_code_for_paper("2407.09359")
get_code_for_paper("2407.09359")
have("2407.09359")

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

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

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

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

Connect an agent — have() is free.