Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

24 November 2026

29 Pages

TRAC-AD: Transformation-Response-Aware Correction for Anomaly Detection

,
and
College of Computer Science, Beijing University of Technology, Beijing 100124, China
*
Author to whom correspondence should be addressed.
This article belongs to the Section Artificial Intelligence

Abstract

Unsupervised visual anomaly detection supports industrial quality inspection using defect-free reference images. Nearest-neighbor detectors can nevertheless assign high anomaly scores to normal regions when illumination or other acquisition conditions change. We propose Transformation-Response-Aware Correction for Anomaly Detection (TRAC-AD), a residual-scoring method built on a frozen DINOv2 backbone. Spatially paired feature differences between normal source images and their photometrically transformed views define a low-dimensional response subspace. During inference, TRAC-AD retrieves normal references in the original fused feature space, removes the response-subspace component of the deepest-layer matching residual, and combines its norm with unchanged scores from the other layers. On AeBAD-S, RobustAD-derived PCB and MetalParts settings, and MVTec AD 2 TESTpub, the mean gains in normalized area under the per-region overlap curve up to a 5% false-positive rate (PRO@0.05) are 3.20, 1.14, and 0.49 percentage points over the matched base pipeline, respectively. Original-resolution TESTpub evaluation yields a mean AucPro@0.05 gain of 0.90 percentage points. These results support using paired photometric responses to improve localization at low false-positive rates under acquisition changes.

1. Introduction

Automated visual inspection supports industrial quality control by identifying defective products and localizing defects [1]. Reliable inspection requires high sensitivity to defects and low false-alarm rates on defect-free products. These requirements apply to both image-level decisions and defect localization: an anomaly map should highlight defects while assigning low scores to normal surface structures. The detector must distinguish changes in appearance caused by defects from those caused by differences in how a normal product is imaged. This distinction is particularly important when acquisition conditions differ from those under which normal reference images were collected.
A common approach establishes a reference for normal appearance from defect-free images [2]. Local feature-matching methods use a pretrained feature extractor to represent image regions and store normal descriptors in a reference set [3,4]. Each test descriptor is compared with its nearest neighbor in this set, and the difference between them defines the matching residual. The residual magnitude quantifies deviation from the retrieved normal reference and serves as a local anomaly score; the scores across image locations form an anomaly map. These local comparisons relate each anomaly score to an observed normal example and provide a direct basis for defect localization.
However, normal reference images are collected under specific acquisition conditions, whereas the appearance of a normal product can vary with illumination, exposure, and color balance. Industrial inspection datasets document these variations and their effects on detection performance under distribution shift [5,6,7]. For example, a change in illumination can alter feature descriptors for an otherwise unchanged surface. A test feature may then deviate from its nearest normal reference, increasing the anomaly score in a defect-free region. This problem stems from scoring anomalies by residual magnitude alone, without accounting for the sensitivity of normal features to imaging conditions. Nearest-neighbor retrieval identifies the closest reference in the available set, but differences caused by acquisition changes can remain in the matching residual. The residual norm does not retain directional information, so acquisition-induced and defect-related feature shifts of comparable magnitude can receive similar anomaly scores. Observing how features of the same normal region respond to imaging changes reveals directions of normal feature variation, which can inform how matching residuals are scored.
We propose Transformation-Response-Aware Correction for Anomaly Detection (TRAC-AD), a residual-scoring method for normal-reference inspection with frozen DINOv2 features. It uses the responses of normal features to photometric transformations to account for acquisition-sensitive directions during scoring. Normal features vary with the material and texture of a region as well as with the conditions under which it is observed. TRAC-AD examines this imaging-related variation by comparing features at corresponding locations in normal source-domain images and their photometrically transformed views. Because both descriptors represent the same normal region, their difference captures the transformation response with scene content held fixed. Collecting these paired responses across regions captures how features respond to photometric transformations over the range of normal appearances in the source images.
The dominant directions of these responses define a response subspace that describes the feature representation’s sensitivity to photometric transformations. The residual between a test feature and its normal reference may contain components along these directions. TRAC-AD removes the response-subspace component of the deepest-layer matching residual after retrieval, while preserving the selected reference and the other layer scores. The normal reference and the response model thus provide complementary information: the reference represents normal appearance, whereas the response model describes how normal features vary under photometric changes. The resulting score reflects both the magnitude of the feature discrepancy and its direction relative to the learned response subspace.
We evaluate TRAC-AD on AeBAD-S, RobustAD-derived settings, and MVTec AD 2 TESTpub, with particular attention to localization at low false-positive rates. Averaged over three configurations, PRO@0.05 gains over the matched base pipeline are 3.20, 1.14, and 0.49 percentage points in these settings, respectively. At the original image resolution, the mean AucPro@0.05 gain on TESTpub is 0.90 percentage points. Matched ablation studies support both estimating the response subspace from paired feature differences and correcting residuals directionally rather than uniformly attenuating their norms. Additional analyses examine how the effect of correction varies with real illumination changes and object category. The main contributions are as follows:
  • We model normal feature responses to photometric transformations using a subspace learned from spatially paired feature differences, linking residual correction to observed variation in normal features.
  • We introduce a residual-scoring rule that applies this subspace after normal-reference retrieval, with a frozen backbone and unchanged reference selection.
  • We evaluate the roles of paired response modeling and directional correction through ablation studies, with further analyses of real illumination changes, category dependence, and computational cost.

3. Materials and Methods

TRAC-AD estimates a response subspace offline from paired photometric feature differences. During inference, it retrieves a normal reference in the original fused feature space and corrects the deepest-layer matching residual before aggregating scores across feature levels and scales. Figure 1 summarizes the workflow.
Figure 1. Overview of TRAC-AD. (a) Paired feature responses to photometric transformations define the L4 response basis U 4 . (b) Retrieval in the fused feature space selects the nearest-neighbor index j * shared by all four layers. The L1–L3 residual norms and the corrected L4 norm are aggregated at each scale, and the two maps are fused. (c) Correction removes the component of the L4 residual that lies in the response subspace. Images and maps are schematic.

3.1. Problem Formulation

We address pixel-level anomaly localization under acquisition shifts using two disjoint sets of normal source-domain images: a fitting set D fit and a calibration set D cal . We use the fitting set to construct the memory bank and collect transformation responses, and the calibration set to estimate scale-normalization statistics and decision thresholds. The backbone and all fitted quantities remain fixed during inference. The definitions below apply independently to each scale.

3.2. Multi-Level Features and Fixed References

We extract features from blocks 5, 11, 17, and 23 (zero-based) of a frozen DINOv2 ViT-L/14 backbone [8] and denote the corresponding feature levels by L1–L4. At each valid token position p, each feature f l ( x , p ) ∈ R d is l 2 -normalized, with d = 1024 . We then average the normalized features and normalize the result to obtain the fused representation:
f F ( x , p ) = norm 2 1 4 ∑ l = 1 4 f l ( x , p ) ,
where, in Equation (1), norm 2 ( v ) = v / ∥ v ∥ 2 . Each memory-bank entry j stores both the fused feature m F , j and the layer features m l , j for the same source token.
For each query token p, let q l , p = f l ( x , p ) and q F , p = f F ( x , p ) . We retrieve a normal reference by exact Euclidean nearest-neighbor search in the original fused feature space and compute the corresponding residuals at all four layers:
j * ( p ) = arg min j ∥ q F , p − m F , j ∥ 2 , δ l , p = q l , p − m l , j * ( p ) .
All four residuals in Equation (2) share the selected reference index j * ( p ) , which remains fixed during scoring. The base pipeline uses each residual norm ∥ δ l , p ∥ 2 as its layer score, whereas TRAC-AD modifies only the L4 score. Retrieval is performed independently for each token, using separate memory banks for the two scales.

3.3. Paired Responses and Rank Selection

The photometric transformation family T includes brightness and contrast adjustments, gamma correction, normalized RGB gains, spatial illumination gradients, vignetting, and soft shadows. Because these transformations preserve image coordinates, features at corresponding positions describe the same image region. For x ∈ D fit , we define the paired L4 response as
r 4 ( x , p , T ) = f 4 ( T ( x ) , p ) − f 4 ( x , p ) .
For each fitting image and scale, we sample 64 valid token positions and reuse these positions across seven transformed views, one per transformation type. Equation (3) thus yields 448 response vectors that describe photometric changes at matched image locations.
We stack the n response vectors into R 4 ∈ R d × n and center them before estimating their covariance:
μ = n − 1 R 4 1 n , R c = R 4 − μ 1 n ⊤ , C r = ( n − 1 ) − 1 R c R c ⊤ .
The leading eigenvectors of C r from Equation (4) form the orthonormal response basis U 4 = [ u 1 , … , u k ] , with U 4 ⊤ U 4 = I k . We center the responses only when estimating the basis; the correction below acts directly on the matching residual.
We use parallel analysis [37] to select k independently for each source and scale. Specifically, we generate 100 null replicates by independently permuting observations within each feature dimension of R c , preserving marginal distributions while disrupting dependence across dimensions. Let λ i ( b ) be the ith largest covariance eigenvalue of replicate b. Starting from the largest eigenvalue, we retain successive eigenvectors whose eigenvalues exceed the 95th percentile of the null eigenvalues at the corresponding rank:
τ i = Quantile 0.95 { λ i ( b ) : b = 1 , … , 100 } , k = max { r ∈ { 0 , … , d } : λ i ( C r ) > τ i ∀ i ≤ r } .
In Equation (5), selection stops at the first eigenvalue at or below its threshold, with k = 0 if this is the largest eigenvalue.

3.4. Deep Residual Correction

Using P 4 = U 4 U 4 ⊤ and Q 4 = I d − P 4 , we remove the component of the L4 matching residual within the response subspace and compute the corrected score as
s 4 ( p ) = ∥ Q 4 δ 4 , p ∥ 2 .
Because the two projected components are orthogonal, the residual energy decomposes as
∥ δ 4 , p ∥ 2 2 = ∥ P 4 δ 4 , p ∥ 2 2 + ∥ Q 4 δ 4 , p ∥ 2 2 .
Equations (6) and (7) give 0 ≤ s 4 ( p ) ≤ ∥ δ 4 , p ∥ 2 . With the reference and projector fixed, adding a component in the learned response subspace leaves the corrected residual unchanged: for any a ∈ R k ,
Q 4 ( δ 4 , p + U 4 a ) = Q 4 δ 4 , p .
Only L4 receives this correction and thus has the invariance in Equation (8) (Section 4.2).

3.5. Aggregation, Calibration, and Inference

At each scale, we average the unchanged L1–L3 residual norms and the corrected L4 residual norm:
s layer ( p ) = 1 4 ∑ l = 1 3 ∥ δ l , p ∥ 2 + s 4 ( p ) .
Because the features are normalized, each term in Equation (9) lies in [ 0 , 2 ] .
The S1 branch resizes the shorter image side to 448 pixels, whereas the native branch processes the query image at its original resolution. Both branches use 448 × 448 tiles with a stride of 336. Each 32 × 32 token-score grid is bilinearly upsampled to the tile resolution. The overlapping tile scores are then combined using a separable 2-D Hann window with a minimum value of 0.05 and valid-position masks. Finally, we remove the padding and map the result to the original image coordinates to obtain S s ( u ) for scale s and pixel u.
Before combining the two resolution branches, we normalize their anomaly maps using held-out normal source images. Quantile-based normalization is also used in EfficientAD to make anomaly maps comparable before fusion [38]. For each method and scale, we sample pixel scores from the anomaly maps for D cal , using the 224-pixel evaluation resolution defined in Section 3.6. From these samples, we estimate the median m s and the 99.5th percentile q s . We then normalize the maps at each scale and average the calibrated scores:
Z s ( u ) = S s ( u ) − m s max ( q s − m s , 10 − 12 ) , S final ( u ) = 1 2 Z S 1 ( u ) + 1 2 Z native ( u ) .
The pixel-level prediction is Y ( u ) = I [ S final ( u ) > θ pix ] , where θ pix is the 99.5th percentile of the fused calibration pixel scores. For image-level detection, we use the maximum pixel score, S img = max u S final ( u ) , and set its threshold to the same quantile of the calibration image scores. Each method uses its own fitted statistics and thresholds under both protocols. The calibrated scores in Equation (10) remain unclipped.
To compute the projection efficiently, we evaluate
Q 4 δ 4 , p = δ 4 , p − U 4 ( U 4 ⊤ δ 4 , p ) .
The two matrix-vector products in Equation (11) require O ( d k ) operations per token, while storing the basis requires O ( d k ) memory per source and scale. Response collection, covariance estimation, and rank selection are performed offline.

3.6. Experimental Setup

Datasets and data use. We evaluate TRAC-AD in three benchmark settings. For AeBAD-S [5], we use 470 normal images for fitting and 51 for calibration. The four test domains contain 305, 273, 689, and 372 images under background, illumination, source-like, and view conditions, respectively. We give each domain equal weight when averaging results.
The RobustAD-derived setting [6] comprises PCB and MetalParts, each with 162 normal images for fitting and 18 for calibration. Testing covers changes in lighting, white balance, pose, shadows, scale, and background, as well as the source-like condition test0. PCB contains 1005 test images across six conditions, whereas MetalParts contains 1171 across seven conditions. We first average results over conditions within each dataset and then give the two datasets equal weight.
MVTec AD 2 TESTpub [7] contains 1084 images across eight categories, including 379 normal and 705 anomalous images. The numbers of fitting/calibration images for each category are can 412/46, fabric 387/43, fruit_jelly 263/37, rice 313/35, sheet_metal 137/19, vial 291/41, wallplugs 293/33, and walnuts 432/48. We average results with equal weights for all categories.
Only normal source-domain images are used to construct memory banks, estimate response bases, and compute calibration statistics. Public-set results informed layer selection and method development. In addition to the public-set evaluations, we report results returned by the official server for the private and private-mixed test sets.
Metrics and evaluation resolutions. The primary metric, PRO@0.05, is the normalized area under the per-region overlap (PRO) curve up to a pixel false-positive rate (FPR) of 0.05. It measures region-level localization at low false-positive rates. To complement this measure, we also report Pixel AUROC (area under the receiver operating characteristic curve), Pixel AP (average precision), and PRO@0.30.
Unless otherwise stated, we evaluate score maps after bilinear resizing to a longest side of at most 224 pixels, without upscaling. Ground-truth masks are downsampled using area interpolation and thresholded to retain pixels with any positive defect coverage. This local protocol uses 4-connected components, gives equal weight to each region, and evaluates 101 thresholds drawn from pooled background-score quantiles. Trapezoidal integration is truncated at the specified FPR endpoint and normalized by that limit.
For comparison, the original-resolution protocol evaluates full-resolution float16 maps using 8-connected regions and thresholds at distinct score values, with ties treated together. We report the resulting normalized area as AucPro@0.05, using an evaluator compatible with the official protocol. For the hidden sets, metrics are returned by the official server.
To assess thresholded decisions, we also measure false-positive rates at the pixel and image levels. Normal-region pixel FPR is the fraction of ground-truth normal pixels classified as anomalous, pooled over normal and defective images within each evaluation unit. Normal-image FPR, in contrast, is the fraction of normal images classified as anomalous. Both use the source-calibrated thresholds defined in Section 3.5.
We report means and sample standard deviations (SDs) across three configurations, numbered 0–2. Independent seeds control memory sampling, response token positions, photometric transformations, and parallel-analysis permutations, while data splits and backbone weights remain fixed. To preserve pairing, we compute gains within each configuration before averaging. The seed schedule is provided in the Supplementary Material.
Controls and implementation. The base pipeline combines memory-bank matching [3] with DINOv2 features [4], using four feature levels, fused-space retrieval, and dual-scale inference. Its token score is s base ( p ) = 1 4 ∑ l = 1 4 ∥ δ l , p ∥ 2 . TRAC-AD modifies this score by projecting only the L4 residual. Normal-PCA applies the same correction but estimates its basis from centered transformed-normal features f 4 ( T ( x ) , p ) , with the same source selection, seed schedule, and retained rank as TRAC-AD. L4-Scalar instead uniformly attenuates the L4 norm, as defined in Section 4.2. To isolate the effects of these scoring choices, all four methods share the backbone, memory banks, retrieved references, and postprocessing, while calibration is fitted separately for each method.
For comparisons with complete detection systems, we also evaluate PatchCore’s three-backbone ensemble with center cropping [3], an adaptation of AnomalyDINO [4], and SuperAD with 16 coreset references, eight rotations, and independent per-layer matching [9]. All systems use the same local evaluator and category averaging. The AnomalyDINO adaptation uses all normal training images as references and extracts DINOv2 ViT-S/14 features after resizing the shorter image side to 448 pixels. It then performs exact CPU 1-NN search on normalized features, reconstructs maps by bilinear interpolation, and applies Gaussian smoothing with σ = 4 , without rotations or foreground masking.
We normalize RGB inputs using channel means ( 0.485 , 0.456 , 0.406 ) and standard deviations ( 0.229 , 0.224 , 0.225 ) , with mean-color padding. S1 images are resized by bicubic interpolation, and backbone inference uses CUDA mixed precision with batches of eight tiles. For memory sampling, we retain 0.1 of the S1 tokens and 1/44 of the native-branch source tokens. Although the native-branch memory bank is built from images resized to a shorter-side length of 896 pixels, query and response features in that branch are extracted at the original resolution.
The photometric ranges are fixed augmentation settings shared across sources. For each source image, we sample transformation parameters uniformly once per transformation type. Brightness, gamma, and contrast parameters are drawn from [ 0.78 , 1.22 ) , [ 0.82 , 1.18 ) , and [ 0.80 , 1.20 ) , respectively. RGB gains are sampled independently from [ 0.90 , 1.10 ) and divided by their channel mean. Spatial illumination gradients use a normalized directional ramp with an angle in [ 0 , 2 π ) and a strength in [ 0.10 , 0.22 ) . Vignetting is generated from a clipped quadratic radial field with a strength in [ 0.10 , 0.28 ) . Soft shadows use center coordinates in [ 0.2 , 0.8 ) of the image width and height, Gaussian widths in [ 0.18 , 0.40 ) , opacity in [ 0.10 , 0.25 ) , and a blur scale of 0.02 max ( H , W ) . All transformations return uint8 RGB images. Section 4.5 evaluates changes in these prescribed strengths, and Section 4.6 tests the fitted detector under stronger brightness and gamma changes. Further implementation details and per-configuration results are provided in the Supplementary Material.
The sensitivity analysis in Section 4.5 covers TESTpub and AeBAD-S illumination. The perturbation, memory-capacity, feature-alignment, and regional energy analyses in Section 4.6, Section 4.7 and Section 4.8 use illumination. Section 4.9 and Section 4.10 analyze the source response spectra and TESTpub image-level errors, respectively. These experiments retain the source splits and three configurations, with the same reference banks for Base and each corrected variant. Inference uses batches of 32 tiles, except for TESTpub sheet_metal at S1, which uses batch one. Performance SD is computed across source configurations, with fixed corruption realizations, memory-subset seeds, and the alignment split.

4. Results

We evaluate whether response-guided residual correction improves defect localization at low false-positive rates under acquisition shifts. Comparisons with the base pipeline and alternative scoring rules assess the contribution of the correction, while analyses across categories and acquisition conditions examine how its effects vary. We also measure its computational cost within the complete detection pipeline.

4.1. Main Results

Effect of residual correction. Table 1 quantifies the effect of residual correction by comparing TRAC-AD with the base pipeline. Mean PRO@0.05 gains are 3.20 percentage points (pp) on AeBAD-S, 1.14 pp in the RobustAD-derived setting, and 0.49 pp on TESTpub, with positive gains in all three configurations. On AeBAD-S, this localization improvement is accompanied by increases of 1.03 and 1.67 pp in Pixel AUROC and Pixel AP, respectively, and a decrease of 1.72 pp in normal-region pixel FPR. The corresponding changes in the RobustAD-derived setting are +0.36, +1.35, and − 0.13 pp.
Table 1. Effect of residual correction under two evaluation protocols.
On TESTpub, PRO@0.05 and Pixel AUROC improve, but mean Pixel AP decreases from 38.35% to 38.01% (Table 2). To determine whether the localization gain persists at original resolution, we evaluate the same 1084 TESTpub images under the second protocol. The mean paired AucPro@0.05 gain is 0.90 ± 0.21 pp (Table 1b), with positive gains in all three configurations. The average localization improvement therefore holds under both evaluation protocols.
Table 2. Comparison of complete detection systems on MVTec AD 2 TESTpub.
Complete-system comparisons. Among the systems compared on TESTpub in Table 2, TRAC-AD achieves the highest PRO@0.05 and PRO@0.30, whereas SuperAD achieves the highest Pixel AUROC. The base pipeline already exceeds SuperAD by 6.12 pp in PRO@0.05; residual correction adds 0.49 pp, bringing the total difference to 6.61 pp.
On both official hidden sets, our submission achieves higher AucPro@0.05 and ClassF1 than the published SuperAD submission [9], with lower SegF1 (Table 3): TRAC-AD scores 27.27% versus 47.18% for SuperAD on private and 23.19% versus 42.51% on private-mixed.
Table 3. Official evaluation of complete systems on hidden test sets.

4.2. Ablation Studies

Choice of feature layer. To identify which feature level benefits from correction, we first apply it to each feature space separately. Relative to the corresponding uncorrected baseline, L4 gains 7.61 pp in AucPro@0.05 and L3 gains 0.39 pp, whereas L1, L2, and the fused space decline (Figure 2a). Consistent with this result, L4 also shows the largest difference between the fractions of residual energy removed in normal and defect regions (Figure 2b). These findings motivate restricting correction to the deepest layer. In this layer-wise comparison, nearest-neighbor references are selected separately in each feature space. Section 4.8 additionally evaluates all layers using the same final fused-space reference, allowing the projection statistics to be examined under the deployed matching rule.
Figure 2. Effect of correction in individual feature spaces on TESTpub for one configuration. (a) Mean change in original-resolution AucPro@0.05 across eight categories, relative to each space’s uncorrected baseline. (b) Fractions of residual energy removed from ground-truth (GT) normal and defect regions in defective images, averaged per image.
Scoring-path comparison. We next compare residual scoring with an alternative path that reconstructs the corrected query feature before fusion. Both paths keep the reference selected in the original fused space fixed. With m 4 = m 4 , j * ( p ) and token indices omitted, reconstruction computes
q ˜ 4 = norm 2 ( m 4 + Q 4 δ 4 ) , q ˜ F = norm 2 ∑ l = 1 3 q l + q ˜ 4 4 ,
and assigns the score ∥ q ˜ F − m F , j * ∥ 2 . Its baseline is the uncorrected fused-feature distance. Residual scoring instead averages layer-wise norms as in Equation (9), with the unprojected four-layer mean as its baseline. We therefore compare each path with its own baseline in Table 4. Reconstruction improves results on AeBAD-S but degrades them in the other two settings, whereas residual scoring improves results in all three.
Table 4. Effect of the scoring path: paired PRO@0.05 gains (pp).
Paired responses versus Normal-PCA. The Normal-PCA comparison tests whether paired responses provide a better correction basis than transformed-normal features. Although both methods improve over the base pipeline, TRAC-AD consistently achieves larger gains (Table 5). Its mean paired gains over Normal-PCA are 0.522 ± 0.022 pp on AeBAD-S illumination and 0.153 ± 0.047 pp on TESTpub under local evaluation, and 0.251 ± 0.126 pp on TESTpub at original resolution. These gains are positive in all three configurations, supporting the use of paired differences to estimate the correction basis.
Table 5. Comparison of residual-scoring controls across configurations 0–2.
Directional correction versus scalar attenuation. To test whether uniform attenuation of the deepest-layer score can reproduce the benefit of directional correction, we use the L4-Scalar control:
s scalar ( p ) = 1 4 ∑ l = 1 3 ∥ δ l , p ∥ 2 + α ∥ δ 4 , p ∥ 2 .
For each source, scale, and configuration, we estimate α in Equation (12) on the untransformed calibration set to match the mean residual energy after TRAC-AD projection:
E raw = 1 | D cal | ∑ x ∈ D cal 1 | P x | ∑ p ∈ P x ∥ δ 4 ( x , p ) ∥ 2 2 , E proj = 1 | D cal | ∑ x ∈ D cal 1 | P x | ∑ p ∈ P x ∥ Q 4 δ 4 ( x , p ) ∥ 2 2 , α = E proj / E raw .
In Equation (13), P x contains valid token occurrences in image tiles, including repeated coverage in overlapping tiles but excluding padding. We first average token energies within each image and then give all images equal weight. The 54 fitted values of α range from 0.566 to 0.842. L4-Scalar applies the resulting fixed factor before stitching and is then calibrated on D cal using the shared procedure.
In all three comparisons, L4-Scalar reduces the mean normalized area under the PRO curve relative to the base pipeline. In contrast, TRAC-AD exceeds L4-Scalar by 1.67–2.93 pp, with positive gains in every configuration (Table 5). TRAC-AD also outperforms L4-Scalar in six of eight TESTpub categories under both protocols, while can and fruit_jelly favor L4-Scalar (Figure 3). Local Pixel AUROC and Pixel AP are higher, and normal-region pixel FPR is lower, for TRAC-AD on average. Together, these comparisons support directional correction over energy-matched uniform attenuation.
Figure 3. Paired gains of TRAC-AD over L4-Scalar by TESTpub category: (a) local PRO@0.05 and (b) original-resolution AucPro@0.05. Gray dots show differences for configurations 0–2; diamonds and whiskers indicate the mean and ± 1 sample SD. Blue and vermilion indicate positive and negative mean differences, respectively. The dashed line marks zero gain.
Basis geometry and sampling stability. We also examine the geometric relationship between the two correction bases. For configuration 0, the Normal-PCA and response bases have a mean projection overlap of 0.650 and a mean principal angle of 34.24 ∘ across 18 source–scale combinations. Here, overlap is the mean squared singular value of U PCA ⊤ U response , and principal angles are the inverse cosines of those singular values. The bases therefore share substantial structure despite their difference in localization performance.
The response-basis estimates remain stable across configurations (Figure 4). Across all 22 source–scale combinations, mean ranks range from 71 to 150. Within a given combination, the difference between the highest and lowest ranks is usually 0–4 and reaches 8 for native-scale sheet_metal. The minimum rank-normalized projection overlap is 0.858, indicating substantial overlap across configurations. On TESTpub, the mean ranks are 117.38 at native scale and 96.75 at S1.
Figure 4. Stability of L4 response subspaces across 11 source domains and two scales. Points and whiskers show the mean and min–max range of (a) ranks across three configurations and (b) projection overlaps across three configuration pairs, computed as ∥ U a ⊤ U b ∥ F 2 / min ( k a , k b ) . The horizontal gray line separates the eight TESTpub categories above from AeBAD-S, MetalParts, and PCB below.

4.3. Robustness and Qualitative Analysis

Category and condition dependence. Figure 5 shows substantial variation in correction gains across categories and conditions. On TESTpub, fabric, rice, vial, and walnuts improve across all configurations, whereas can, fruit_jelly, sheet_metal, and wallplugs decline. Fabric has the largest mean gain (+4.04 pp), and wallplugs has the largest loss ( − 1.53 pp). The RobustAD-derived results show a similar dependence on the evaluation setting: MetalParts improves in all seven conditions, whereas PCB improves only under Shadow and declines in the other five. Thus, the effect of correction varies with both category and acquisition condition.
Figure 5. Variation in local PRO@0.05 gains over the base pipeline by (a) TESTpub category, (b) MetalParts condition, and (c) PCB condition. Points and whiskers indicate the mean and ± 1 sample SD across configurations 0–2. Blue and vermilion indicate positive and negative mean changes, respectively. The dashed line marks zero gain, and asterisks identify source-like conditions.
The pattern also depends on the metric. Across 11 shifted RobustAD-derived conditions and three configurations, Pixel AUROC improves in all 33 condition–configuration combinations. Pixel AP and PRO@0.05 improve, and normal-region pixel FPR decreases, in 21 combinations each. Low-FPR localization and source-threshold decisions therefore show greater variation across conditions than AUROC.
Response to real illumination changes. To examine the response to real illumination changes, we analyze scene-matched TESTpub images from seven categories under regular, underexposed, overexposed, and shift 1–3 lighting conditions. We quantify the photometric change relative to the regular-lighting image x 0 using the root mean square (RMS) log-luma deviation:
ν ( x , x 0 ) = 1 | Ω | ∑ p ∈ Ω log 2 L x ( p ) + ϵ L x 0 ( p ) + ϵ 2 ,
where L x = 0.2126 R x + 0.7152 G x + 0.0722 B x for RGB values in [ 0 , 1 ] , ϵ = 1 / 255 , and Ω is the image grid. Shifts 1–3 denote distinct lighting conditions.
For configuration 0, we compute FPR per image at original resolution and local PRO@0.05 per defective image. To estimate uncertainty, we resample paired scenes 2000 times within each category and average categories with equal weights to obtain 95% bootstrap confidence intervals.
Shifts 1 and 2 produce similar luma deviations ( ν = 0.3420 and 0.3424), yet their FPR responses differ (Figure 6). For shift 1, FPR changes by +0.006 pp, with a confidence interval spanning zero. In contrast, shift 2 reduces FPR by 0.097 pp, with an interval entirely below zero. Across all six conditions, PRO gains range from +0.63 to +1.03 pp, with the underexposed and overexposed confidence intervals lying wholly above zero. The false-positive response thus varies across conditions with comparable global luma deviations.
Figure 6. Response to real illumination changes across seven TESTpub categories for configuration 0. Panels show changes relative to the base pipeline in (a) per-image normal-region pixel FPR at original resolution and (b) local PRO@0.05 per defective image. Points indicate category-averaged changes, and whiskers show 95% confidence intervals from scene-paired bootstrapping. Dashed lines mark zero change. Luma deviation ν is defined in Equation (14).
Qualitative behavior and failures. Figure 7 illustrates the benefits and limitations of correction in four overexposed TESTpub examples. In fabric, correction concentrates the response around the defect. However, bright local structures still elicit responses in normal rice, while defect responses in can and wallplugs weaken and remain poorly separated from surrounding structure. These examples illustrate the trade-off: suppressing acquisition-sensitive components can also remove useful defect information.
Figure 7. Qualitative results for overexposed TESTpub images under configuration 0: (a) normal rice and defects in (b) fabric, (c) can, and (d) wallplugs. Amber boxes mark corresponding regions of interest (ROIs), and green outlines indicate GT defects. All panels show native-resolution crops, with a common source-derived color range for both methods’ score maps. White contours indicate each method’s source-calibrated decision boundary: solid for the base pipeline and dashed for TRAC-AD.

4.4. Efficiency

We measure computational cost on all 1084 TESTpub images using an RTX 3090 Ti, full-resolution dual-scale inference, an image batch size of 1, a tile batch size of 8, and one CPU compute thread. The software environment comprises Python 3.10.20, PyTorch 2.8.0, and CUDA 12.8. End-to-end timing includes all steps from preprocessing through map fusion but excludes warm-up and disk I/O. The execution order of the two methods alternates across images.
TRAC-AD increases mean latency from 1.832 to 1.841 s/image (Table 6). The paired overhead before rounding is 8.87 ms/image, or 0.48%, and projection accounts for 5.73 ms/image of this increase. This corresponds to a throughput of approximately 0.54 images/s. Consistent with the small mean overhead, the two latency distributions overlap closely (Figure 8).
Table 6. Inference latency and peak memory on TESTpub.
Figure 8. Empirical cumulative distributions of latency for 1084 TESTpub images on an RTX 3090 Ti. (a) End-to-end latency, excluding warm-up and disk I/O. (b) Paired latency difference between TRAC-AD and the base pipeline; the orange and dashed lines mark the mean (+8.87 ms) and zero, respectively.
Peak allocated CUDA memory increases by 0.09 GiB, while peak reserved memory rises from 3.44 to 4.05 GiB; the host resident set size (RSS) remains unchanged. On disk, the memory banks for one configuration occupy about 14.1 GiB. Storing the response bases adds one 1024 × k matrix per source and scale, with k ≤ 154 .

4.5. Sensitivity to Source Calibration Choices

We examine the effects of response rank, transformation amplitude, and transformation family on TESTpub and the 273-image AeBAD-S illumination domain. Each factor is varied independently, using the same backbone and memory banks across configurations 0–2. TESTpub results are averaged over the eight categories, and calibration is fitted separately for each scoring variant. Rank multipliers are 0, 0.5 , 0.75 , 1, and 1.25 , with nearest-integer rounding. The extended basis includes higher-order response eigenvectors, while rank zero recovers Base. Amplitude multipliers 0.5 , 1, and 1.5 scale deviations from the identity transformation, with spatial geometry held fixed. Global-only and spatial-only variants retain four and three transformation types, respectively. Each family contributes its corresponding response samples, and parallel analysis selects its rank.
Table 7 reports all nine settings. On TESTpub, the local PRO gains for amplitude multipliers 0.5 , 1, and 1.5 are 0.467 , 0.488 , and 0.477 pp. Smaller response ranks retain more Pixel AP on TESTpub, whereas the illumination domain benefits more from the larger ranks. Likewise, global-only transformations yield a PRO gain of 0.129 pp on TESTpub and 2.507 pp on illumination, compared with 0.536 and 2.019 pp for spatial-only transformations. Global responses are therefore more beneficial on illumination, while spatial responses contribute more on TESTpub. The default setting combines both families and selects the rank from source responses by parallel analysis.
Table 7. Sensitivity with matched memory banks. AD2 denotes the macro-average over eight TESTpub categories; Illum. denotes AeBAD-S illumination. Values are means and sample SDs over three configurations. Response bases and ranks are re-estimated for each transformation strength and family. The global-only and spatial-only families contain four and three transformations, respectively.

4.6. Frozen-Model Tests Beyond the Calibration Range

To assess robustness under changes in acquisition conditions, we test all 273 illumination images with fixed response bases, memory banks, normalization statistics, and decision thresholds. The conditions are clean; brightness factors 0.78 , 1.22 , 0.56 , and 1.44 ; gamma exponents 0.64 and 1.36 ; Gaussian blur radii of one and two original-image pixels; and additive RGB Gaussian noise with standard deviations 0.02 and 0.05 on the [ 0 , 1 ] intensity scale. The outer brightness settings and both gamma settings exceed the corresponding source transformation parameter ranges. Perturbations precede preprocessing and preserve image geometry and masks. Noise realizations are fixed per image and shared across severity, methods, and source configurations.
Across all ten perturbed conditions, TRAC-AD improves mean PRO, Pixel AP, and source-threshold F1 over the paired Base and reduces normal-pixel FPR (Table 8). The PRO improvements range from 1.688 to 3.060 pp. Strong darkening and noise affect absolute performance. Brightness 0.56 lowers TRAC-AD PRO from 76.218 to 74.249 % . At noise standard deviation 0.05 , normal-pixel FPR increases from 5.272 to 6.705 % for TRAC-AD and reaches 9.948 % for Base. The increase in false positives reflects the sensitivity of source-calibrated thresholds to stronger noise.
Table 8. Frozen-model robustness on all 273 AeBAD-S illumination images. Values are percentages (mean ± sample SD over three source configurations). Normal-pixel FPR is lower-is-better; other metrics are higher-is-better. Brightness, gamma, blur and noise severities are defined in Section 4.6.

4.7. Memory Capacity and Feature Alignment

We retain nested, seeded uniform subsets containing 100 % , 50 % , or 25 % of the aligned memory rows. Each subset preserves row correspondence across the fused and four layer banks and is shared by Base and TRAC-AD. Response bases remain fixed; each method and capacity uses all 51 source-normal calibration images. At quarter capacity, TRAC-AD PRO decreases by 0.619 ± 0.225 pp relative to its full bank and remains 2.010 ± 0.076 pp above the matched Base. Pixel AP decreases while fixed-threshold F1 increases, showing that capacity and recalibration affect ranking and operating-point metrics differently (Table 9).
Table 9. Memory capacity on AeBAD-S illumination. All reduced banks use nested uniform sampling and independent source calibration. Values are percentages, mean ± sample SD over three source configurations.
Across the two branches, storage for the five feature banks decreases from approximately 1431 to 358 MiB. We measure inference time using configuration 0 and three fixed decoded source images, with warmup, CUDA synchronization, and alternating method order. The benchmark uses batches of 32 tiles and records fifteen RGB-to-fused-score observations, including preprocessing, backbone extraction, retrieval, scoring, and fusion. Decoding and disk writes are excluded. Full- and quarter-capacity TRAC-AD take 4.223 ± 0.103 and 3.548 ± 0.128 s, respectively. Total peak CUDA allocation decreases from 3.650 to 3.230 GiB. Reducing the memory bank therefore lowers storage, latency, and peak allocation on the illumination domain.
We compare residual correction with feature alignment by applying CORAL [39] to the frozen patch-matching detector. Its regularized covariance transform, with λ = 1 , is applied to the source fused and layer banks while preserving all dimensions and aligned row identities. Queries retain their target representation. Source calibration descriptors receive the source transform before independent calibration. We retain the existing L 2 feature normalization and denote this detector as CORAL-L2. A fixed label-agnostic split assigns 55 illumination images to unlabeled covariance estimation and 218 to evaluation; Base and TRAC-AD use the same 218 evaluation images. The adaptation set contains 44 anomalous and 11 normal images, and all images contribute to covariance estimation.
On this held-out split, Base, CORAL-L2, and TRAC-AD achieve PRO scores of 74.510 ± 0.140 , 74.612 ± 0.134 , and 76.720 ± 0.104 % , respectively (Table 10). TRAC-AD exceeds CORAL-L2 by 2.107 ± 0.041 pp. The larger gain from residual correction is observed on this illumination split, where covariance alignment uses an unlabeled target mixture.
Table 10. Feature alignment on the same 218 illumination evaluation images. CORAL uses 55 disjoint unlabeled adaptation images. Values are percentages, mean ± sample SD over three source configurations.

4.8. Region-Level Projection and Segmentation Trade-Offs

We examine how correction affects normal and defect regions by computing projected residual energy with the same fused-space nearest reference on all layers. A valid token belongs to the defect region if its patch intersects the resized positive mask; overlapping tile occurrences remain distinct. Each layer uses its own source-selected response rank. On the illumination domain at native scale, L4 removes 60.87 % of normal-region and 45.47 % of defect-region residual energy. The normal-minus-defect gap is 15.401 ± 0.142 pp, the largest mean among the four layers. Restricting normal regions to anomalous images gives a similar gap of 15.132 ± 0.138 pp. At S1, L2 and L4 have gaps of 18.520 ± 0.184 and 18.409 ± 0.501 pp. Supplementary Table S8 reports all layer-wise fractions and their normal-to-defect ratios. Figure 9 shows that the relative attenuation of normal and defect residuals varies with scale under the layer-specific rank selections.
Figure 9. Projection-energy analysis on AeBAD-S illumination using the final fused-space nearest reference for all layers. Each layer retains its source-selected basis and rank. Statistics cover three source configurations; the normal/defect energy contrast depends on scale.
On TESTpub, the matched-bank evaluation gives mean changes of + 0.488 pp in local PRO, + 0.896 pp in original-resolution AucPro, − 0.335 pp in Pixel AP, and + 0.014 pp in local source-threshold F1. The changes vary across categories. Wallplugs loses 2.108 pp in AP and 0.827 pp in fixed-threshold F1; sheet_metal loses 1.586 and 1.090 pp, respectively. To examine threshold sensitivity, we also compute the maximum F1 over thresholds using the evaluation masks. Both categories show a decrease in this post hoc maximum, indicating a loss in the attainable precision–recall balance. Reported fixed-threshold F1 uses source-normal calibration. Can instead loses 1.013 pp in local PRO while gaining 0.024 pp in AP, illustrating a different trade-off across operating regions.
Figure 10 shows the precision–recall curves and source-calibrated operating points under the local evaluation protocol. The curves relate the category-level ranking changes to the precision and recall obtained at the fixed thresholds.
Figure 10. Pixel precision–recall curves for matched Base and TRAC-AD on eight TESTpub categories and AeBAD-S illumination. Each method has three configuration curves; markers indicate source-calibrated thresholds. Display curves are subsampled, while AP is computed from all scores.

4.9. Response Energy and Subspace Rank

We examine the rank differences in Figure 4 through the spectra of the L4 response covariance. The analysis covers the eight TESTpub sources and AeBAD-S, with two branches and three source configurations per source. Covariance trace measures the total centered response energy. The participation ratio, ( ∑ j λ j ) 2 / ∑ j λ j 2 , describes how broadly this energy is distributed across directions, where λ j are the covariance eigenvalues. Parallel analysis selects the leading directions by comparing the observed eigenvalues with their corresponding permutation thresholds.
Figure 11 shows different patterns for response energy and dimension. At S1, can has a covariance trace of 0.04351 , a participation ratio of 19.79 , and a mean rank of 71.0 . Sheet_metal has a lower trace of 0.00564 but a broader spectrum, with a participation ratio of 97.45 and a mean rank of 138.7 . For can, moving from S1 to the native branch lowers the trace by 14.3 % , while the participation ratio increases to 39.25 and the rank to 108.7 . Across the 27 source–configuration pairs, the native rank increases in 25 pairs, including 17 with lower response energy.
Figure 11. L4 response energy, participation ratio, and parallel-analysis rank for the eight TESTpub sources and AeBAD-S. Points and error bars show means and sample SD over three source configurations. S1 and native branches have distinct response spectra.
These differences reflect the distribution of response energy relative to the permutation reference. Uniform scaling of every response vector by a nonzero factor multiplies both the observed and permuted covariance eigenvalues by the same squared factor, preserving their comparisons. Scale and category changes can instead alter the shape of the spectrum and the resulting rank. A larger basis provides more directions for correction, while the energy removed from a test residual is determined by its projection onto those directions. The region-level analysis in Section 4.8 measures this overlap for normal and defect regions.

4.10. Image-Level Failure Analysis

To examine the category-level losses, we decompose the thresholded predictions into false positives and false negatives on all 162 can, 150 wallplugs, and 114 sheet_metal images in TESTpub. Each method uses its own source-calibrated threshold. We pool pixels within each category and configuration before calculating the metrics in Table 11. Here, pixel FPR on normal images isolates false detections on defect-free inputs; recall pools defect pixels from anomalous images, and precision pools predictions from all images. All counts use the local evaluation grid.
Table 11. Pixel decisions at source-calibrated thresholds on three TESTpub categories. FPR pools pixels from normal images; recall pools defect pixels, and precision pools predictions from all images. Values are percentages, mean ± sample SD over three source configurations.
Wallplugs shows the largest recall decrease, from 58.85 % to 53.68 % , together with an increase in normal-image pixel FPR from 2.945 % to 2.986 % . Its AP and post hoc maximum F1 decrease by 2.108 and 3.431 pp. Sheet_metal also loses recall, from 53.64 % to 52.04 % , and its AP and maximum F1 decrease by 1.586 and 1.395 pp. These categories exhibit reduced defect coverage at the source threshold and a lower attainable precision–recall balance. Can shows a different pattern: normal-image pixel FPR decreases by 0.035 pp and defect recall by 0.725 pp, while AP and maximum F1 increase by 0.024 and 0.370 pp.
The image-level changes reveal variation within each category. Using the three-configuration mean for each image, wallplugs recall decreases on 43 anomalous images, increases on 12, and is unchanged on 35. Figure 12 illustrates examples from both directions. In the underexposed example, correction reduces false positives from 58 to 41 pixels but increases false negatives from 5 to 7 pixels. This yields higher precision and lower recall on the same image. The supplementary material includes the corresponding can and sheet_metal cases, normal-image examples, and case-selection procedure.
Figure 12. Wallplugs examples with decreased and increased defect recall. Crops use the ground-truth bounding box with eight local pixels of padding and a minimum side of 32 pixels. Heatmaps share a score-to-source-threshold scale from 0 to 2; white contours mark the decision threshold and cyan contours the ground truth. Reported counts and metrics refer to the full local image. Cases are selected near the median three-configuration change within each direction; the displayed configuration is the closest with the same direction.

5. Discussion

Paired responses capture how normal features change under photometric transformations. The gains over Normal-PCA support using these responses to estimate the correction basis, while the L4-Scalar comparison supports directional correction over uniform attenuation. Response-subspace directions can also carry defect information, so removing these residual components can weaken localization. The category-level losses and regional energy measurements illustrate this trade-off. Correction is restricted to the deepest layer, preserving the other three layer scores.
The benefits also vary with the evaluation criterion. On TESTpub, improved region coverage at low false-positive rates is accompanied by a small decrease in Pixel AP. Wallplugs and sheet_metal lose both fixed-threshold and post hoc maximum F1, indicating that correction affects the attainable precision–recall balance as well as the source-calibrated operating point. Similarly, on the hidden sets, TRAC-AD achieves higher AucPro@0.05 than SuperAD but lower SegF1. These results highlight two remaining challenges: preserving defect responses and maintaining reliable decisions when source-calibrated thresholds are transferred to new acquisition conditions.
The regional energy analysis helps explain this trade-off. On AeBAD-S illumination, correction removes a larger fraction of residual energy from normal regions than from defect regions. With each layer’s source-selected rank, L4 has the largest mean gap at native scale, while L2 and L4 are close at S1. Defect regions also lose projected energy. The TESTpub image-level analysis identifies changes in thresholded decisions: wallplugs and sheet_metal have lower defect recall, and individual images can gain precision while losing defect coverage. The effect of correction therefore depends on both residual alignment and the source-calibrated decision threshold.
The source spectra further distinguish response magnitude from dimension. Can has greater S1 response energy than sheet_metal but a lower selected rank; its native rank also increases as its total response energy decreases. Parallel analysis compares the observed spectrum with a permutation reference, so the rank reflects the distribution of supported response directions. Together with the regional projection measurements, these results relate the correction to both the structure of source responses and their overlap with test residuals.
FiCo studies representation compensation under distribution shift [20], and paired-light inspection uses well-lit and low-light observations [24]. TRAC-AD instead estimates response directions from synthetic source transformations. On AeBAD-S illumination, it retains gains over Base under the tested brightness, gamma, blur, and noise changes. Strong darkening reduces absolute localization performance, while high noise increases false positives at the fixed source threshold. Transformation-family effects also vary across datasets: global responses provide larger gains on illumination, whereas spatial responses are more beneficial on TESTpub. These differences suggest that the useful response directions depend on the acquisition conditions.
The current evaluation uses DINOv2 ViT-L/14 with aligned memory banks and dual-scale inference. WinCLIP uses spatial CLIP features and normal references [16], while PatchCore retrieves local features from a representative normal memory [3]. Both detectors provide query and normal-reference features on which residual correction could operate. Transfer would require paired photometric descriptors in the new feature space, new response bases and source calibration, and an evaluation of which layers preserve useful defect information after projection. For hierarchical convolutional or hybrid backbones, feature stride and receptive field also determine the spatial correspondence used to estimate responses.
A further direction is to adjust the correction strength through δ − α ( δ ) U U ⊤ δ , where 0 ≤ α ≤ 1 . For orthonormal U, the squared norm becomes ∥ ( I − U U ⊤ ) δ ∥ 2 + ( 1 − α ) 2 ∥ U ⊤ δ ∥ 2 , so the coefficient controls the retained projected energy. A calibrated anomaly probability p a ( δ ) could define α ( δ ) = 1 − p a ( δ ) , retaining more projected energy for likely defects. In visual reinforcement learning, Zeng et al. [40] use gradients to identify the regions that contribute to the similarity between an observation and its augmented view. In TRAC-AD, a map computed from paired normal views could weight the patch differences used to estimate the response basis. After retrieval, the weight of the matched normal patch could guide how much of the L4 residual to remove along that basis.
Computational cost is a further consideration. The TESTpub benchmark reports 1.84 s/image and a correction overhead of 0.48%, limiting the full pipeline’s use in high-throughput inspection. On the illumination inputs evaluated with batches of 32 tiles, reducing aligned memory to one quarter lowers feature-bank storage by 75%, RGB-to-score latency by 16.0%, and total peak CUDA allocation by 11.5%, while retaining a PRO gain over the matched Base. The smaller reduction in latency reflects the fixed cost of backbone extraction and other processing stages.

6. Conclusions

TRAC-AD uses paired photometric responses from normal images to correct the deepest-layer matching residual while preserving reference retrieval and the other layer scores. Across three evaluation settings, this correction improves average localization performance at low false-positive rates. Comparisons with Normal-PCA and uniform attenuation further support the contributions of paired-response modeling and directional correction. The correction adds a latency overhead of 0.48% in the evaluated pipeline. Future work should address the remaining challenges of preserving defect information across categories and maintaining reliable decisions when source-calibrated thresholds are transferred to new acquisition conditions.

Supplementary Materials

The following supporting information can be downloaded at https://www.mdpi.com/article/10.3390/electronics15235488/s1. The supplementary PDF presents random seeds (Table S1), per-configuration results (Tables S2 and S3), calibration statistics and thresholds (Tables S4 and S5), L4 response-basis ranks and spectra (Tables S6 and S7), and layer-wise projected-energy fractions (Table S8). Figures S1 and S2 show normalized response spectra and parallel-analysis thresholds. Figures S3–S5 show the 12 selected examples for can, wallplugs, and sheet_metal, respectively. An accompanying data archive provides per-configuration results, image-level counts, all displayed case configurations, and analysis scripts.

Author Contributions

Conceptualization, Y.C. and R.T.; methodology, Y.C. and Y.Z.; software, Y.Z.; validation, Y.C. and Y.Z.; formal analysis, Y.C. and Y.Z.; investigation, Y.C. and Y.Z.; data curation, Y.Z.; writing—original draft preparation, Y.C.; writing—review and editing, Y.Z. and R.T.; visualization, Y.Z.; supervision, R.T.; project administration, R.T. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The benchmark data are available from the original providers: AeBAD [5], https://github.com/zhangzilongc/MMR (accessed on 21 October 2026); RobustAD [6], https://huggingface.co/datasets/AmazonScience/RobustAD (accessed on 21 October 2026); and MVTec AD 2 [7], https://www.mvtec.com/research-teaching/datasets/mvtec-ad-2 (accessed on 21 October 2026). Ground truth for the MVTec AD 2 hidden test sets is retained by the provider, and the reported hidden-set scores were obtained from its evaluation server. The Supplementary Materials contains per-configuration results, calibration summaries, and response-basis specifications. The implementation of TRAC-AD and the evaluation code are available from the corresponding author upon reasonable request.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Jayawardena, A.; Sul, J.H.; Moratuwage, D.; Wijayaraja, J.L.; Piyathilaka, L. State of the Art in AI-Based Visual Inspection for Industrial Quality Control: Methods, Benchmarks, Challenges, and Autonomous Systems. Electronics 2026, 15, 2727. [Google Scholar] [CrossRef] [Scilit]
  2. Bergmann, P.; Fauser, M.; Sattlegger, D.; Steger, C. MVTec AD—A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection. In Proceedings of the 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR); IEEE: Piscataway, NJ, USA, 2019; pp. 9584–9592. [Google Scholar] [CrossRef] [Scilit]
  3. Roth, K.; Pemula, L.; Zepeda, J.; Schölkopf, B.; Brox, T.; Gehler, P. Towards Total Recall in Industrial Anomaly Detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR); IEEE: Piscataway, NJ, USA, 2022; pp. 14298–14308. [Google Scholar] [CrossRef] [Scilit]
  4. Damm, S.; Laszkiewicz, M.; Lederer, J.; Fischer, A. AnomalyDINO: Boosting Patch-Based Few-Shot Anomaly Detection with DINOv2. In Proceedings of the Winter Conference on Applications of Computer Vision (WACV); IEEE: Piscataway, NJ, USA, 2025; pp. 1319–1329. [Google Scholar]
  5. Zhang, Z.; Zhao, Z.; Zhang, X.; Sun, C.; Chen, X. Industrial anomaly detection with domain shift: A real-world dataset and masked multi-scale reconstruction. Comput. Ind. 2023, 151, 103990. [Google Scholar] [CrossRef] [Scilit]
  6. Pemula, L.; Zhang, D.; Dabeer, O. Robust AD: A Real World Benchmark Dataset For Robustness in Industrial Anomaly Detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops; IEEE: Piscataway, NJ, USA, 2025; pp. 4086–4096. [Google Scholar]
  7. Heckler-Kram, L.; Neudeck, J.H.; Scheler, U.; König, R.; Steger, C. The MVTec AD 2 Dataset: Advanced Scenarios for Unsupervised Anomaly Detection. Int. J. Comput. Vis. 2026, 134, 175. [Google Scholar] [CrossRef] [Scilit]
  8. Oquab, M.; Darcet, T.; Moutakanni, T.; Vo, H.; Szafraniec, M.; Khalidov, V.; Fernandez, P.; Haziza, D.; Massa, F.; El-Nouby, A.; et al. DINOv2: Learning Robust Visual Features without Supervision. Trans. Mach. Learn. Res. 2024. Available online: https://openreview.net/forum?id=a68SUt6zFt (accessed on 19 November 2026).
  9. Zhang, H.; Chen, H.; Cheng, Y.; Wu, S.; Sun, L.; Han, L.; Shi, Z.; Qi, L. SuperAD: A Training-free Anomaly Classification and Segmentation Method for CVPR 2025 VAND 3.0 Workshop Challenge Track 1: Adapt & Detect. arXiv 2025, arXiv:2505.19750. [Google Scholar]
  10. Roming, L.; Lehnerer, F.; Funk, J.V.; Michel, A.; Maier, G.; Längle, T.; Beyerer, J. SuperADD: Training-free Class-agnostic Anomaly Segmentation—CVPR 2026 VAND 4.0 Workshop Challenge Industrial Track. arXiv 2026, arXiv:2605.14808. [Google Scholar]
  11. Zhang, X.; Li, G.; Henderson, P.; Aragon-Camarasa, G.; Long, Z. Is Task-Specific Training Necessary for Anomaly Detection? In Proceedings of the 43rd International Conference on Machine Learning (ICML); PMLR: Seoul, Republic of Korea, 2026; Volume 306, pp. 156406–156436. [Google Scholar]
  12. Gu, Z.; Zhu, B.; Zhu, G.; Chen, Y.; Tang, M.; Wang, J. UniVAD: A Training-free Unified Model for Few-shot Visual Anomaly Detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR); IEEE: Piscataway, NJ, USA, 2025; pp. 15194–15203. [Google Scholar]
  13. Liu, Y.; Gao, X.; Wen, J.Z.; Luo, H. Unsupervised Image Anomaly Detection and Localization in Industry Based on Self-Updated Memory and Center Clustering. IEEE Trans. Instrum. Meas. 2023, 72, 2512010. [Google Scholar] [CrossRef] [Scilit]
  14. Chen, R.; Yu, G.; Qin, Z.; Song, K.; Tu, J.; Jiang, X.; Liang, D.; Peng, C. Patch Matching for Few-Shot Industrial Defect Detection. IEEE Trans. Instrum. Meas. 2024, 73, 2522611. [Google Scholar] [CrossRef] [Scilit]
  15. Shi, Y.; Gao, B.; Yang, G.; Li, H.; Woo, W.L. Industrial Anomaly Detection System: A Multicase Algorithm Leveraging Feature Information and Memory Bank. IEEE Trans. Instrum. Meas. 2025, 74, 3523809. [Google Scholar] [CrossRef] [Scilit]
  16. Jeong, J.; Zou, Y.; Kim, T.; Zhang, D.; Ravichandran, A.; Dabeer, O. WinCLIP: Zero-/Few-Shot Anomaly Classification and Segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR); IEEE: Piscataway, NJ, USA, 2023; pp. 19606–19616. [Google Scholar]
  17. Zhou, Q.; Pang, G.; Tian, Y.; He, S.; Chen, J. AnomalyCLIP: Object-agnostic Prompt Learning for Zero-shot Anomaly Detection. In Proceedings of the International Conference on Learning Representations; Kim, B., Yue, Y., Chaudhuri, S., Fragkiadaki, K., Khan, M., Sun, Y., Eds.; ICLR: Vienna, Austria, 2024; Volume 2024, pp. 49705–49737. [Google Scholar]
  18. Ooi, X.P.; Kong, S.G. TextureCLIP: Cross-Dataset Zero-Shot Texture Anomaly Segmentation with Triadic Descriptive Prompting. Electronics 2026, 15, 2220. [Google Scholar] [CrossRef] [Scilit]
  19. Park, H. Semantic-Preserving Dense Localization via DINO-Guided Refinement of CLIP Anomaly Maps. Electronics 2026, 15, 3309. [Google Scholar] [CrossRef] [Scilit]
  20. Chen, Z.; Luo, X.; Wang, W.; Zhao, Z.; Su, F.; Men, A. Filter or Compensate: Towards Invariant Representation from Distribution Shift for Anomaly Detection. In Proceedings of the AAAI Conference on Artificial Intelligence; AAAI Press: Washington, DC, USA, 2025; Volume 39, pp. 2420–2428. [Google Scholar] [CrossRef] [Scilit]
  21. Liao, J.; Xu, X.; Su, Y.; Tu, R.C.; Liu, Y.; Tao, D.; Yang, X. Robust Distribution Alignment for Industrial Anomaly Detection under Distribution Shift. arXiv 2025, arXiv:2503.14910. [Google Scholar]
  22. Chen, S.F.; Liu, Y.M.; Liu, C.C.; Chen, T.P.C.; Wang, Y.C.F. Domain-Generalized Textured Surface Anomaly Detection. In Proceedings of the 2022 IEEE International Conference on Multimedia and Expo (ICME); IEEE: Piscataway, NJ, USA, 2022; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
  23. Villanueva López, S.; Soria-Olivas, E.; Sánchez-Montañés, M. RGB Ensemble Strategies for Unsupervised Industrial Anomaly Detection on the AutoVI Dataset. Electronics 2026, 15, 2077. [Google Scholar] [CrossRef] [Scilit]
  24. Hoang, D.C.; Tan, P.X.; Nguyen, A.N.; Pham, M.K.; Duong, T.H.A.; Huynh, T.M.; Bui, S.A.; Nguyen, D.M.; Ha, Q.H.; Trinh, V.A.; et al. Unsupervised industrial anomaly detection using paired well-lit and low-light images. J. Comput. Des. Eng. 2025, 12, 41–61. [Google Scholar] [CrossRef] [Scilit]
  25. Huang, C.; Guan, H.; Jiang, A.; Zhang, Y.; Spratling, M.; Wang, Y.F. Registration Based Few-Shot Anomaly Detection. In Proceedings of the Computer Vision–ECCV 2022; Avidan, S., Brostow, G., Cissé, M., Farinella, G.M., Hassner, T., Eds.; Springer: Cham, Switzerland, 2022; pp. 303–319. [Google Scholar] [CrossRef] [Scilit]
  26. Zhai, Y.; Pan, W.; Liang, Y.; Zhu, H.; Long, Z.; Coscia, P.; Genovese, A.; Piuri, V.; Scotti, F. Bidirectional Feature Pyramid Siamese Anomaly Detection Network With Cellular Anomaly Generation for Container Marking. IEEE Trans. Instrum. Meas. 2025, 74, 5022817. [Google Scholar] [CrossRef] [Scilit]
  27. Rippel, O.; Mertens, P.; König, E.; Merhof, D. Gaussian Anomaly Detection by Modeling the Distribution of Normal Data in Pretrained Deep Features. IEEE Trans. Instrum. Meas. 2021, 70, 5014213. [Google Scholar] [CrossRef] [Scilit]
  28. Defard, T.; Setkov, A.; Loesch, A.; Audigier, R. PaDiM: A Patch Distribution Modeling Framework for Anomaly Detection and Localization. In Proceedings of the Pattern Recognition. ICPR International Workshops and Challenges; Springer International Publishing: Cham, Switzerland, 2021; pp. 475–489. [Google Scholar] [CrossRef] [Scilit]
  29. Jiang, J.; Wei, S.; Xu, X.; Cui, Y.; Liu, X. Unsupervised Anomaly Detection and Localization Based on Two-Hierarchy Normalizing Flow. IEEE Trans. Instrum. Meas. 2024, 73, 5032011. [Google Scholar] [CrossRef] [Scilit]
  30. Simard, P.; Victorri, B.; LeCun, Y.; Denker, J. Tangent Prop—A formalism for specifying selected invariances in an adaptive network. In Proceedings of the Advances in Neural Information Processing Systems; Morgan-Kaufmann: San Francisco, CA, USA, 1991; Volume 4. [Google Scholar]
  31. Simard, P.; LeCun, Y.; Denker, J. Efficient Pattern Recognition Using a New Transformation Distance. In Proceedings of the Advances in Neural Information Processing Systems; Morgan-Kaufmann: San Francisco, CA, USA, 1992; Volume 5. [Google Scholar]
  32. Fang, Z.; Wang, X.; Li, H.; Liu, J.; Hu, Q.; Xiao, J. FastRecon: Few-shot Industrial Anomaly Detection via Fast Feature Reconstruction. In Proceedings of the 2023 IEEE/CVF International Conference on Computer Vision (ICCV); IEEE: Piscataway, NJ, USA, 2023; pp. 17435–17444. [Google Scholar] [CrossRef] [Scilit]
  33. Lendering, C.; Akdag, E.; Bondarev, E. SubspaceAD: Training-Free Few-Shot Anomaly Detection via Subspace Modeling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR); IEEE: Piscataway, NJ, USA, 2026; pp. 28557–28566. [Google Scholar]
  34. Han, S.; Chu, S.; Nowak, M.; Chin, P. SPARC: Subspace Position-Aware Robust Few-Shot Calibration for Distribution-Shifted Industrial Anomaly Detection. arXiv 2026, arXiv:2608.18585. [Google Scholar]
  35. Lin, S.; Cai, E.; Zeng, Y.; Zhu, Y.; Zhao, W.; Zhang, L.; Cao, B. A hyperspectral target detection method by combining robust dictionaries and constrained energy minimization regularized low-rank and sparse representation model. Adv. Space Res. 2026, 78, 3523–3544. [Google Scholar] [CrossRef] [Scilit]
  36. Lin, S.; Zhang, M.; Cheng, X.; Shi, L.; Gamba, P.; Wang, H. Dynamic Low-Rank and Sparse Priors Constrained Deep Autoencoders for Hyperspectral Anomaly Detection. IEEE Trans. Instrum. Meas. 2024, 73, 2500518. [Google Scholar] [CrossRef] [Scilit]
  37. Horn, J.L. A rationale and test for the number of factors in factor analysis. Psychometrika 1965, 30, 179–185. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  38. Batzner, K.; Heckler, L.; König, R. EfficientAD: Accurate Visual Anomaly Detection at Millisecond-Level Latencies. In Proceedings of the 2024 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV); IEEE: Piscataway, NJ, USA, 2024; pp. 127–137. [Google Scholar] [CrossRef] [Scilit]
  39. Sun, B.; Feng, J.; Saenko, K. Return of Frustratingly Easy Domain Adaptation. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence; AAAI Press: Washington, DC, USA, 2016; pp. 2058–2065. [Google Scholar] [CrossRef] [Scilit]
  40. Zeng, Y.; Wang, X.; Cheng, Y. Similarity-guided state attention for visual reinforcement learning. Neural Netw. 2027, 205, 109560. [Google Scholar] [CrossRef] [Scilit] [PubMed]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.