Text from the interactive explanation
INP-Former++: Advancing Universal Anomaly Detection via Intrinsic Normal Prototypes and Residual Learning
Wei Luo, Haiming Yao, Yunkang Cao, Qiyu Chen, Ang Gao, Weiming Shen, Wenyong Yu
A flaw usually covers a small patch, so the rest of the same photo is a perfectly aligned picture of “normal”. INP-Former++ distils that surrounding normality into six intrinsic normal prototypes (INPs), rebuilds every patch from them alone, and whatever cannot be rebuilt is the anomaly.
Illustrative simulation: simple colour/texture features stand in for the paper's trained network. Parts are drawn procedurally; the extract → rebuild → score steps follow the paper's design.
Product
Paint a defect
Drag across the part to paint the selected defect, or use “Add random defect”.
Inspection result
Animation
Six learnable queries attend over the part's own 784 patch tokens; each prototype is a weighted mix of those patches.
The decoder may only combine prototypes. There is no path that copies a patch through, so a flaw has nothing to be rebuilt from.
The rebuild error is the anomaly map; the image score is the mean of its top 1% of values.
Borrowed normality vs intrinsic normality
Most detectors judge a test image against normal references stored from training images. The paper calls the weakness of this misaligned normality and illustrates two forms of it (its Fig. 1). Below, the part currently on the bench is judged three ways, with the same decoder and threshold; only the source of the normal prototypes changes.
Few-shot memory
Multi-class memory
Intrinsic prototypes
White outline: the painted (ground-truth) defect. “Defect caught” is the share of defect pixels above the threshold; “false alarms” is the share of normal pixels above it. Simulation values, not measurements.
Six prototypes, one image
The image (392 × 392 px) is cut into 28 × 28 = 784 patch tokens by a frozen, pre-trained DINOv2 ViT-Base/14. In the INP Extractor, M = 6 learnable tokens act as queries in cross-attention over these patch tokens, so every INP is a weighted combination of the image's own patches. Below, each patch of the bench part is tinted by the prototype it is closest to.
The conference version, INP-Former, trained the extractor with an INP coherence loss that pulls every patch towards its nearest INP. The authors observed that this hard version can fall into a shortcut: all 784 patches get assigned to one single INP (their Fig. 4b). INP-Former++ replaces it with a soft INP coherence loss, which asks each patch to match a softmax-weighted combination of INPs, so patches with different meaning end up with different prototypes (Fig. 4c).
Measured effect (Table 9, MVTec-AD): swapping the hard for the soft loss raises pixel-level AP from 65.54 to 65.88, a modest gain; it matters more for zero-shot transfer, where AUPRO rises from 77.3 to 79.6 (Table 13).
On the number of INPs, the paper's ablation (Fig. 8a) finds that image-level detection stabilises once M exceeds 4, while pixel-level localisation keeps improving as M grows; M = 6 was chosen to balance accuracy and computational cost.
Simulation note: the hard mode is a replay of the reported behaviour, not a live training run. The six prototypes are collapsed towards the image average and every patch is assigned to INP 1.
The decoder may only speak in prototypes
The INP-guided decoder (8 layers) uses its own tokens as queries but only the INPs as keys and values. Every output token is therefore a combination of normal prototypes: normal regions are rebuilt well, anomalies are not. This sidesteps the “identical mapping” trap, in which a reconstruction network learns to copy anything through, anomalies included.
With M = 6 the formula reproduces Table 1 exactly: 7,220,640 + 6,623,232 multiply-adds instead of 943,496,960 + 943,509,504, about 99.3% fewer; the paper summarises the saving in computation and memory as nearly 99.2%. Memory figures assume 4-byte values.
Sharpening the map: residual learning
Training only on normal images leaves the contrast between normal and abnormal regions modest. INP-Former++ adds residual learning: pseudo-anomalies are synthesised with Perlin-noise masks filled with textures from the DTD dataset (as in DRAEM), passed through the frozen encoder and the INP decoder, and a small segmentation head (two transposed convolutions and one convolution, trained with Dice loss) learns to read the feature residual.
Illustration: masks, textures and parts are simulated; the residual and mask come from this page's simplified model.
A stop-gradient on the residual means only the segmentation head learns from the pseudo-anomalies; the reconstruction model itself is not biased towards them. Removing it costs a lot: pixel-level AP on MVTec-AD falls from 75.56 to 63.37 (Table 9).
At test time the final map is the average of the upsampled reconstruction error and the predicted mask, and the image score is the mean of the top 1% of map values. Drag the split to compare both maps for the part on the bench.
Measured ablation, MVTec-AD pixel-level AP (Table 9)
Residual learning also enables a semi-supervised mode: with 10 real anomalous images per category, their defect regions are pasted into normal images alongside the pseudo-anomalies. On MVTec-AD this lifts AUPRO to 96.8 (Table 7).
How the full model performs
Everything in this section is the authors' measured benchmark results, transcribed from the paper's tables: MVTec-AD, VisA and Real-IAD for industrial inspection, Uni-Medical for medical scans.
—
More data, better detection (Fig. 11)
mAD (mean of seven metrics) of INP-Former++ in each setting, from zero-shot to semi-supervised.
Accuracy vs. cost on Real-IAD (Table 12)
FLOPs (log scale) against mAD; bubble area shows parameter count. Hover, tap or focus a bubble.
Limitation stated by the authors: zero-shot performance remains suboptimal. Trained on Real-IAD and tested on MVTec-AD, INP-Former++ reaches the best AUPRO (79.6, against 64.6 for WinCLIP and 44.0 for APRIL-GAN) but a lower image-level AUROC (81.9) than these vision-language methods, which the authors attribute to the lack of language prompts.
Paper and credits
INP-Former++ extends the authors' CVPR 2025 conference paper, “Exploring intrinsic normal prototypes within a single image for universal anomaly detection” (INP-Former), with the soft INP coherence loss, residual learning and the semi-supervised and zero-shot evaluations.
The interactive scenes on this page are original illustrative simulations: procedurally drawn parts, hand-built colour and texture features instead of the trained vision transformer, and a simplified version of the extract → rebuild → score pipeline. Their numbers describe the simulation only. All benchmark numbers in the results section, the ablation chart and the attention-cost table are as reported by the authors. No figures or images from the paper are reproduced.
Topics in this iPaper
Computer science
Anomaly detection (AD) is essential for industrial inspection and medical diagnosis
Abstract, page 1
Engineering
This technique has seen widespread application in industrial defect detection [4], [5] and medical disease screening [6].
Section 1 Introduction, page 1
anomaly detection
Index Terms—Universal Anomaly Detection, Intrinsic Normal Prototypes, Feature Reconstruction, Residual Learning.
Index Terms, page 1
computer vision
arXiv:2506.03660v2 [cs.CV] 30 Jun 2025
arXiv header, page 1
vision transformer
INP-Former++ adopts ViT-Base/14 with DINO2-R [47] weights as the default pre-trained encoder.
Section 4.1.3 Implementation Details, page 7
prototype learning
In contrast, our INPs are dynamically extracted from the test image, providing more aligned alternatives for normality representation.
Section 2.2 Prototype Learning, page 4
industrial inspection
three widely used AD industrial datasets——MVTec-AD [4], VisA [5], and RealIAD [71]
Section 4.1.1 Datasets, page 7
semi supervised learning
we conduct performance comparison experiments under a semi-supervised setting, where each category includes 10 anomalous samples.
Section 4.2.5, page 9
few shot learning
Few-shot (4-shot) anomaly detection performance on different AD datasets.
Section 4.2.3 and Table 5, page 8-9