SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.02424 · CVPR · 2025

Exploring Intrinsic Normal Prototypes within a Single Image for Universal Anomaly Detection

Wei Luo, Xiaotian Zhang, Weiming Shen, Yunkang Cao, Yuqi Cheng, Haiming Yao, Jianan Lou, Wenyong Yu

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 1 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/2503.02424.json · badge: /api/ran/2503.02424.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
septmars/DL community (classifier label)
classifier basis not recorded on the link
3 ran · 1 no recorded run
luow23/INP-Former community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
INP_Former Ran
ran on a synthesized input · constructed an object; no result was computed
luow23/INP-Former/models/uad.py
code served (permissive licence) · get_code("ea7fb411e7e6b7ea")
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, INP_Former: 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
import torch.nn as nn
import math

torch.manual_seed(0)

# Create a minimal encoder with required attributes and methods
class MinimalEncoder(nn.Module):
    def __init__(self, num_blocks=10, hidden_dim=4):
        super().__init__()
        self.num_register_tokens = 0
        self.hidden_dim = hidden_dim
        self.blocks = nn.ModuleList([MinimalBlock(hidden_dim) for _ in range(num_blocks)])
        
    def prepare_tokens(self, x):
        # x shape: (B, C, H, W) -> (B, L, D)
        # Simulate tokenization: add class token and reshape
        B, C, H, W = x.shape
        tokens = x.reshape(B, C, -1).permute(0, 2, 1)  # (B, H*W, C)
        class_token = torch.ones(B, 1, self.hidden_dim)
        return torch.cat([class_token, tokens], dim=1)  # (B, 1+H*W, D)

class MinimalBlock(nn.Module):
    def __init__(self, hidden_dim=4):
        super().__init__()
        self.linear = nn.Linear(hidden_dim, hidden_dim)
    
    def forward(self, x):
        return self.linear(x)

# Create encoder with 10 blocks
encoder = MinimalEncoder(num_blocks=10, hidden_dim=4)

# Create minimal bottleneck (sequence of blocks)
bottleneck = nn.ModuleList([
    nn.Linear(4, 4),
    nn.Linear(4, 4)
])

# Create minimal aggregation module
class AggregationBlock(nn.Module):
    def __init__(self, hidden_dim=4):
        super().__init__()
        self.linear = nn.Linear(hidden_dim, hidden_dim)
    
    def forward(self, prototype, x):
        # prototype: (B, L, D), x: (B, N, D)
        return self.linear(prototype)

aggregation = nn.ModuleList([
    AggregationBlock(hidden_dim=4),
    AggregationBlock(hidden_dim=4)
])

# Create minimal decoder
class DecoderBlock(nn.Module):
    def __init__(self, hidden_dim=4):
        super().__init__()
        self.linear = nn.Linear(hidden_dim, hidden_dim)
    
    def forward(self, x, agg_prototype):
        return self.linear(x)

decoder = nn.ModuleList([
    DecoderBlock(hidden_dim=4),
    DecoderBlock(hidden_dim=4)
])

# Create prototype token
prototype_token = [torch.randn(1, 4)]

ARGS = {
    'encoder': encoder,
    'bottleneck': bottleneck,
    'aggregation': aggregation,
    'decoder': decoder,
    'target_layers': [2, 3, 4, 5, 6, 7, 8, 9],
    'fuse_layer_encoder': [[0, 1, 2, 3, 4, 5, 6, 7]],
    'fuse_layer_decoder': [[0, 1, 2, 3, 4, 5, 6, 7]],
    'remove_class_token': False,
    'encoder_require_grad_layer': [],
    'prototype_token': prototype_token
}
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 INP_Former — 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 INP_Former 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
conv1x1 Ran
ran; our contract draft was wrong, not the code
septmars/DL/ReContrast/de_resnet.py
pointer only (licence: MIT); the stored copy get_code serves, from medaitech/scrd4ad, is pointer only (licence: NONE) · get_code("2a80220dabcb742a")
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 medaitech/scrd4ad, 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.

conv3x3 Ran
ran; our contract draft was wrong, not the code
septmars/DL/ReContrast/de_resnet.py
pointer only (licence: MIT); the stored copy get_code serves, from medaitech/scrd4ad, is pointer only (licence: NONE) · get_code("600ff2c45e0de056")
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 medaitech/scrd4ad, 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.

deconv2x2 Ran
ran; our contract draft was wrong, not the code
septmars/DL/ReContrast/de_resnet.py
pointer only (licence: MIT); the stored copy get_code serves, from SimonThomine/DistillationAD, is pointer only (licence: NONE) · get_code("8d035278d5e4a82a")
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 SimonThomine/DistillationAD, 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.

resnet18 Not yet run
unverified (harvested, no recorded run)
septmars/DL/ReContrast/resnet.py
code served (permissive licence) · get_code("a631c312fa4d7cbd")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 3 the same month, 2 later) and 2 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
conv1x1 112 other papers
103 dated earlier, 1 the same month, 8 later · 6 only as an assembly brick
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
1806.01531 (2018-06)
Deep Mixture of Experts via Shallow Embedding
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
and 109 more not named here
conv3x3 111 other papers
103 dated earlier, 1 the same month, 7 later · 6 only as an assembly brick
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
1806.01531 (2018-06)
Deep Mixture of Experts via Shallow Embedding
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
and 108 more not named here
deconv2x2 3 other papers
2 dated earlier, 1 the same month
2201.10703 (2022-01)
Anomaly Detection via Reverse Distillation from One-Class Embedding
2405.14325 (2024-05)
Dinomaly: The Less Is More Philosophy in Multi-Class Unsupervised Anomaly Detection
2503.13828 (2025-03)
Scale-Aware Contrastive Reverse Distillation for Unsupervised Medical 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 detection (AD) is essential for industrial inspection, yet existing methods typically rely on "comparing" test images to normal references from a training set. However, variations in appearance and positioning often complicate the alignment of these references with the test image, limiting detection accuracy. We observe that most anomalies manifest as local variations, meaning that even within anomalous images, valuable normal information remains. We argue that this information is useful and may be more aligned with the anomalies since both the anomalies and the normal information originate from the same image. Therefore, rather than relying on external normality from the training set, we propose INP-Former, a novel method that extracts Intrinsic Normal Prototypes (INPs) directly from the test image. Specifically, we introduce the INP Extractor, which linearly combines normal tokens to represent INPs. We further propose an INP Coherence Loss to ensure INPs can faithfully represent normality for the testing image. These INPs then guide the INP-Guided Decoder to reconstruct only normal tokens, with reconstruction errors serving as anomaly scores. Additionally, we propose a Soft Mining Loss to prioritize hard-to-optimize samples during training. INP-Former achieves state-of-the-art performance in single-class, multi-class, and few-shot AD tasks across MVTec-AD, VisA, and Real-IAD, positioning it as a versatile and universal solution for AD. Remarkably, INP-Former also demonstrates some zero-shot AD capability. Code is available at: https://github.com/luow23/INP-Former.

For agents

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

get_harvested_code_for_paper("2503.02424")
get_code_for_paper("2503.02424")
have("2503.02424")

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

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

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

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

Connect an agent — have() is free.