Abstract
Zero-shot industrial anomaly detection (ZSAD) aims to identify defects in unseen products without manual labeling. While current Vision Transformer (ViT)-based models excel at global context, their patch-based nature often results in coarse, blurry anomaly maps. We present AnoRefiner, a plug-and-play refinement module that transforms these coarse maps into precise, pixel-level localizations. By utilizing coarse anomaly scores as spatial guides and implementing a progressive group-wise test-time training strategy, AnoRefiner significantly reduces background noise and sharpens defect boundaries. Our method achieves up to a 5.2% gain in pixel-AP on standard benchmarks like MVTec AD and VisA.
Introduction
The "holy grail" of automated quality inspection is identifying defects in products a model has never encountered, without the need for manual labeling. Current state-of-the-art ZSAD methods typically leverage large-scale pre-trained models like CLIP. However, because these models operate on image patches, the resulting anomaly maps are often "coarse"—appearing as blurry blobs that indicate a general region rather than the exact shape of a defect.
Previous attempts to refine these maps often rely on training decoders with synthetic anomalies. This approach frequently suffers from a "sim-to-real" gap, where synthetic noise fails to represent real-world defects like hairline cracks or subtle discolorations. Consequently, standard refinement decoders often miss real defects or produce false positives. AnoRefiner addresses these challenges by treating the coarse anomaly map itself as a rich spatial prior.
Methods
AnoRefiner introduces two primary innovations: the Anomaly Refinement Decoder (ARD) and Progressive Group-wise Test-time Training (PGT).
Anomaly Refinement Decoder (ARD)
Unlike traditional decoders that rely solely on image features, the ARD treats the coarse anomaly map as a vital spatial cue. It incorporates two specialized modules:
- Anomaly-Attention (AA) Module: This module employs an exponential weighting scheme to amplify features in regions where the coarse map suggests an anomaly exists, effectively suppressing background noise.
- Bidirectional Perception and Interaction (BI) Block: In the final stages, this block facilitates "cross-talk" between refined image features and the anomaly map, ensuring the output is both spatially precise and semantically consistent.
Progressive Group-wise Test-time Training (PGT)
To adapt to specific industrial environments, AnoRefiner uses a PGT strategy. In a factory setting, identical products are processed in sequence. PGT divides this stream into groups. The first group is used to train the ARD using pseudo-labels generated from the ZSAD model. The trained refiner is then applied to the subsequent group. This allows the model to learn the specific textures and geometry of the product currently on the assembly line, leveraging the inherent redundancy of industrial data.
Key Insights
The core philosophy of AnoRefiner is that refinement should be a mutual process. Image features should guide the anomaly map, but the anomaly map should also guide feature enhancement. By shifting from single-image processing to group-wise processing, the model can better distinguish "normal" variations from actual defects.
Key Results
The researchers evaluated AnoRefiner as a "plug-in" for several leading ZSAD backbones, including APRIL-GAN, VCP-CLIP, and MuSc, using the MVTec AD and VisA datasets.
- Quantitative Performance: AnoRefiner provided significant boosts across metrics, achieving up to a 5.2% gain in pixel-AP and a 3.4% gain in pixel-F1 scores. On MVTec AD, it improved the VCP-CLIP backbone's F1-max from 49.4% to 52.2%.
- Qualitative Improvement: As shown in the visualizations, AnoRefiner produces tight, accurate masks that follow the actual contours of defects, whereas baseline models show large, diffuse heatmaps.
- Robustness: The method proved resilient even when training sets were contaminated with real anomalies (up to 40%), demonstrating its practical utility in real-world production lines.
Limitations and Future Work
While effective, AnoRefiner introduces computational overhead due to the PGT phase, which requires training the decoder for several epochs during inference. Future work could focus on reducing this latency. Additionally, while PGT reduces reliance on synthetic data, the initial training phase still utilizes synthetic textures. Developing more realistic, on-the-fly synthetic anomaly generation could further bridge the remaining sim-to-real gap.
Conclusion
AnoRefiner represents a significant step forward for zero-shot industrial inspection. By effectively utilizing coarse anomaly maps as spatial priors and adapting to production environments through group-wise training, it provides the pixel-level precision necessary for reliable automated quality control.
Summary updated