UniSpector: Towards Universal Open-set Defect Recognition via Spectral-Contrastive Visual Prompting
Abstract
Even though industrial inspection systems should be capable of recognizing unprecedented defects, most existing approaches operate under a closed-set assumption, which prevents them from detecting novel anomalies. While the visual prompting approach provides a scalable alternative, it struggles in industrial settings where subtle inter-class differences and high intra-class variance make prompt-to-region matching ambiguous and cause prompt embeddings to collapse, limiting the effectiveness of existing methods. To address these challenges, we introduce UniSpector— a Universal Inspector for open-set defect detection and segmentation. To empower defect prompt embeddings for robust recognition of novel defects, it comprises two key components: the Spatial–Spectral Prompt Encoder (SSPE) and the Contrastive Prompt Encoder (CPE). SSPE extracts orientation-invariant frequency cues and fuses them with spatial features to distinguish subtle defects. CPE encodes the prompt into an angular space to facilitate semantically meaningful embedding of unseen defect prompts. In addition, to improve adaptability to novel defect types, we introduce Prompt-guided Query Selection (PQS) to generate adaptive object queries aligned with the prompt.To standardize evaluation, we introduce Inspect Anything (InsA), the first benchmark for visual-prompt-based open-set defect localization.Experiments demonstrate that UniSpector significantly surpasses prior baselines by at least 19.7\% and 15.8\% in AP50b and AP50m, respectively. These results show that our method enables a scalable, retraining-free inspection paradigm for continuously evolving industrial environments.