Abstract
ResAD++ presents a novel framework for class-agnostic anomaly detection (AD), enabling a single model to identify defects in unseen object categories without retraining. By shifting the focus from raw features to "residual features"—the difference between an input and its nearest normal reference—the model effectively decouples class-specific attributes from the underlying concept of abnormality. Combined with a feature hypersphere constraint and distribution matching, ResAD++ achieves state-of-the-art performance across diverse industrial and medical datasets, demonstrating exceptional generalization from industrial parts to medical imaging.
Introduction: The Challenge of Generalization
Traditional anomaly detection follows a "one-model-per-class" paradigm, where a model trained on fabric cannot be used for metal components without extensive retraining. Even multi-class models typically require exposure to all target classes during the training phase. The authors of ResAD++ identify two primary barriers to true class-agnostic generalization: feature correlation and scale correlation.
Neural networks naturally learn features tied to specific class attributes, such as texture or shape. Consequently, when a model encounters a new class, the "normal" features look entirely foreign. Furthermore, different objects produce feature vectors with varying numerical scales; a minor deviation in one class might constitute a major anomaly in another, making universal thresholding impossible.
Methodology: Learning the "Residual"
ResAD++ addresses these hurdles by focusing on the difference between an input and its normal counterpart through a multi-stage pipeline.
Residual Feature Generating
Instead of analyzing raw feature vectors, the model utilizes a few-shot pool of normal reference images. For any given input, it identifies the "nearest neighbor" in the reference pool and subtracts the reference feature from the input feature. This residual acts as a high-pass filter: for normal samples, the subtraction cancels out class-specific textures, resulting in a vector near zero. For anomalies, the unique "abnormal" components remain, regardless of the object's category.
Feature Hypersphere Constraining
To resolve the scale correlation issue, ResAD++ employs a Feature Constraintor to map residuals into a unified spatial hypersphere. The authors introduce a log-barrier bi-contraction OCC loss that pushes normal features into a thin "shell"—a phenomenon known as the soap-bubble effect. This creates a sharp, universal decision boundary that applies across all classes, ensuring that a "large" deviation is numerically consistent across different domains.
Distribution Matching and Estimation
To further bridge the gap between training and testing distributions, the model uses Vector Quantization (VQ) based Feature Distribution Matching (FDM). This injects the "style" of the training distribution into test samples. Finally, a Normalizing Flow (NF) model learns the probability distribution of these constrained residuals. During inference, anomalies are identified by their low log-likelihood relative to the learned "normal shell."
Experimental Results and Insights
The authors evaluated ResAD++ across eight diverse datasets, including industrial benchmarks (MVTecAD, VisA, BTAD) and medical imaging (Kvasir-Seg, BraTS).
- State-of-the-Art Performance: On MVTecAD, using only 8-shot normal references, the model achieved 98.6% image-level AUROC and 96.7% pixel-level AUROC.
- Cross-Domain Generalization: Remarkably, a model trained on industrial components can effectively detect tumors in brain MRI scans (BraTS) without fine-tuning. This confirms that the model learns the abstract concept of an anomaly rather than just memorizing specific textures.
- Efficiency: ResAD++ maintains a smaller parameter footprint and faster inference times compared to many competing few-shot and CLIP-based methods.
Conclusion
ResAD++ represents a significant shift in anomaly detection, moving away from class-specific modeling toward a universal, agnostic approach. By leveraging the "power of subtraction" and geometric constraints, it provides a robust solution for real-world applications where new object categories appear frequently and labeled data is scarce. Future work may extend this logic to video data and explore ways to reduce sensitivity to the quality of the reference pool.
Summary updated