MetaUAS: Universal Anomaly Segmentation with One-Prompt Meta-Learning

Authors:   gao
Venue: NeurIPS_cc_2024_Conference
Published: 2024-05-13 13:44:39

Abstract: Zero- and few-shot visual anomaly segmentation relies on powerful vision-language models that detect unseen anomalies using manually designed textual prompts. However, visual representations are inherently independent of language. In this paper, we explore the potential of a pure visual foundation model as an alternative to widely used vision-language models for universal visual anomaly segmentation.
We present a novel paradigm that unifies anomaly segmentation into change segmentation. This paradigm enables us to leverage large-scale synthetic image pairs, featuring object-level and local region changes, derived from existing image datasets, which are independent of target anomaly datasets. We propose a one-prompt Meta-learning framework for Universal Anomaly Segmentation (MetaUAS) that is trained on this synthetic dataset and then generalizes well to segment any novel or unseen visual anomalies in the real world. To handle geometrical variations between prompt and query images, we propose a soft feature alignment module that bridges paired-image change perception and single-image semantic segmentation. This is the first work to achieve universal anomaly segmentation using a pure vision model without relying on special anomaly detection datasets and pre-trained visual-language models. Our method effectively and efficiently segments any anomalies with only one normal image prompt and enjoys training-free without guidance from language. Our MetaUAS significantly outperforms previous zero-shot, few-shot, and even full-shot anomaly segmentation methods. Code and Models: https://github.com/gaobb/MetaUAS.

Main paper: 
 introduction: 
 Visual anomaly classification (AC) and segmentation (AS) aims to group images and pixels into two different semantics, normal and anomalous, facilitating many applications such as industrial defect inspection in manufacturing [4, 39, 3, 74] , medical image diagnosis [28, 65] , and video surveillance [55, 40, 18] , etc. Generally, AS is performed first, and then AC is obtained based on postprocessing of the segmentation results. Therefore, AS is more essential than AC. AS can be viewed as binary semantic segmentation assuming that pixel-level annotated images are available. Unfortunately, it is usually difficult to collect anomaly images due to their scarcity in practical applications, and pixel-level annotations also involve labor costs. Based on available training images, e.g., only normal, normal with noise, few-shot normal or anomaly, and multi-class normal, have led to different types of AS tasks, such as unsupervised [47, 31, 72, 12, 37, 29] , fully-unsupervised [9, 27, 38] , fewshot [24, 14, 66, 69, 15] , and unified AS [70, 17] , etc. These methods achieve excellent performance on seen objects but often perform poorly on unseen objects.To address this fragmentation, recent works, such as WinCLIP [26] and AnomalyCLIP [76] , have attempted to design universal models, that are capable of recognizing anomalies for unseen objects. They typically build on vision-language models (i.e., CLIP [42] ), benefiting from strong generalization ability. However, WinCLIP [26] still struggles with handcrafted text prompts about defects. Further, AnomalyCLIP [76] learns general prompt embedding through developing specialized modules but requiring fine-tuning on an auxiliary domain dataset with pixel-level annotations. In addition to being flexible, these vision-language-based methods are still weak in anomaly segmentation. Accurate anomaly segmentation is crucial in real-world applications, such as industrial inspection, as anomalies often relate to the area, shape, and location where they occur. On the other hand, we know that visual representations are not dependent on language in the animal world [16] . In particular, the principles of visual perception in non-human primates are very similar to humans [58] . Although there is room for universal AS based on visual-language models and worthwhile further to pursue, in this paper, we want to explore how far we can go with a pure visual model without any guidance from language.To explore a more general AS framework, lets first review how the visual system perceives anomalies. Generally, humans can perceive anomalies when an input significantly deviates from those normal patterns stored in our brains. There is evidence to support this point in neuroscience. For example, predictive coding theory [43] postulates that the brain constantly generates and updates a "mental model". The mental model compares its expectations (or predictions) with the actual inputs from the visual cortex. This process allows the brain to perceive anomalies. In fact, PatchCore [47] captures normal local patch features, stores them in a memory bank, and recognizes anomalies by comparing input features with the memory bank. In addition, some distribution-based methods [12] learn a multivariate Gaussian distribution from normal local features and then utilize a distance metric to measure anomalies. However, these memory-and distribution-based methods usually require a certain number of normal images and thus are limited in universal (i.e., open-world) scenarios.Actually, we can build similar concepts in AS. First, given one normal image prompt for each class, we take it as the expected output. Then, the actual input could be any query images from the same class of the normal prompt. Last but not least, how to construct a "mental model" to compare between a given normal image prompt and any query images. Despite these challenges, we can imagine that the "mental model" should satisfy several basic principles. First, it should have a strong generalization ability to perceive anomalies facing unseen objects or textures. Second, it can perform pixel-level anomaly segmentation only given one normal image prompt. Third, its training does not depend on target domain distribution or any guidance from language.To obtain the "metal model", we rethink AS tasks and find they can be transformed into change segmentation between one normal image prompt and query images. From this novel perspective, we are capable of leveraging a larger number of synthetic image pairs that exhibit appearance changes based on available image datasets. We assume these synthesized image pairs carry mask annotations indicating change regions. Inspired by the "mental model" in predictive coding theory [43] , we propose a simple but effective framework that learns the "metal model" in a one-prompt meta-learning manner. The meta-learning ensures strong generalization [8] when applying the model for segment unseen anomalies. Our contributions are summarized as follows:• We present a novel paradigm that unifies anomaly segmentation into change segmentation. This paradigm enables us to leverage large-scale synthetic image pairs with object-level and local region changes, thereby overcoming the long-standing challenge of lacking large-scale anomaly segmentation datasets.• We propose a one-prompt meta-learning framework training on synthesized images and generalizing well on real-world scenarios. To handle geometrical variations between prompt and query images, we proposed a soft feature alignment module that builds a bridge between paired-image change perception and singe-image semantic segmentation. • We provide a pure visual foundation model for universal anomaly segmentation that can serve as an alternative to widely used vision-language models. Our method, which requires only a single normal image prompt and no additional training, effectively and efficiently segments any visual anomalies. On three industrial anomaly benchmarks, our approach achieves state-of-the-art performance, while also enjoying faster speed and requiring fewer parameters. 
related work: 
 Unsupervised AS aims to segment anomaly pixels for both normal and anomaly testing images only given full normal training images. Unsupervised AS can be categorized into two learning paradigms, separated and unified models. Most AS methods focus on training separated models for different objects or textures. However, this separated paradigm may be impractical, as it requires high memory consumption and storage burden, especially with the number of classes increasing. In contrast, the unified models attempt to detect anomalies for all categories using a single model. Compared to the separated mode, the unified paradigm is more challenging as it requires handling more complex data distributions.From a modeling perspective, AS methods can be roughly grouped into three groups, embedding, discriminator, and reconstruction. Embedding-based methods, such as PaDiM [12] , MDND [44] , PatchCore [47] , CS-Flow [49] and PyramidFlow [29] , assume that offline features extracted from a pre-trained model preserve discriminative information and thus help to separate anomalies from normal samples. They usually model normal features to a normal distribution or store them in a memory bank. Then, anomaly scores are calculated by comparing testing features and the modeled distribution or the memory bank. Discriminator-based methods, such as CutPaste [31] , DRAEM [72] , [10] , and SimpleNet [37] , typically convert unsupervised AS to supervised ones by introducing pseudo (synthesized) anomaly samples. The pseudo-anomaly samples are generated by pasting random patches or adding Gaussian noise to normal images or features. Naturally, a binary anomaly classifier or segmentation model can be trained on normal and pseudo-anomaly samples in a supervised manner. Reconstruction-based AS, such as autoencoder [59, 2, 20, 23] , generative adversarial networks [41, 67, 71] and reconstruction networks [73, 45, 36] , assume that anomalous regions should not be able to be properly reconstructed and thus result in high reconstruction errors since they do not exist in normal training samples. These methods tend to be computationally expensive because they involve reconstruction in image space. The recent knowledge distillation [5, 62, 61, 52, 13] or feature reconstruction methods [70, 75, 68] train a student or reconstruction network to match a fixed pre-trained teacher network and achieve a good balance between effectiveness and efficiency. However, all these methods are limited to recognizing anomalies in a close set as the same as the training set but often perform poorly on unseen classes in open-world scenarios.Few-shot AS pays attention to learning with only a limited number of normal samples. TDG [54] proposes a multi-scale hierarchical generative model, which jointly learns self-supervised discriminator and generator in an adversarial training manner. DifferNet [48] detects defects utilizing a normalizing-flow-based density estimation from a few normal image features. RegAD [24] learns the category-agnostic feature registration, enabling the model to detect anomalies in new categories given a few normal images without fine-tuning. GraphCore [66] utilizes graph representation and provides a visual isometric invariant feature. FastRecon [15] utilizes a few normal samples as a reference to reconstruct a normal version for a query sample with distribution regularization, where the final anomaly detection can be achieved by sample alignment. Some works [14, 69] consider another few-shot setting where a limited number of samples is given from the anomalous classes. Instead of learning few-shot models with a few normal or anomaly images, we push it to a new extreme only using one normal image as a visual prompt at the inference stage, not involving model training.Zero-and Few-shot AS mainly utilizes large pre-trained vision-language models, e.g., CLIP [42] , have shown unprecedented generality, and achieved impressive performance. WinCLIP [26] firstly utilizes multiple handcrafted textual prompts on a powerful CLIP model that can yield excellent zeroand few-shot AS performance. AnomalyCLIP [76] learns object-agnostic text prompts that capture generic normality and abnormality in an image regardless of its foreground objects. InCtrl [77] detects residual CLIP visual features between test images and in-context few-shot normal samples. However, optimizing AnomalyCLIP [76] and InCtrl [77] requires an auxiliary domain dataset including normal and anomaly images. PromptAD [32] introduces the concept of explicit anomaly margin, which mitigates the training challenge caused by the absence of anomaly images. Furthermore, AnomalyGPT [21] incorporates a visual-language model and a large language model applying multiturn dialogues. It not only indicates the presence and location of the anomaly but also provides a detailed description of anomalies. Instead of visual-language models, ACR [30] and MuSc [33] perform zero-shot AS only requiring information from batch-and full-level testing images, but they may be limited in privacy protection scenarios. Overall, existing most methods primarily use textual prompts based on visual-language models to identify anomalies. Different from these methods, we explore universal AS using one normal image as a visual prompt without guidance from language or information from testing images. Zero-and few-shot AS methods rely on powerful vision-language models that are capable of handling unseen anomalies, benefiting from their strong generalization. For further boosting zero-shot performance, some recent works attempt to optimize models by an auxiliary domain dataset including normal and anomaly images with pixel-level annotations. Although they can generalize to different domains, training models with normal and anomaly images conflict with the original intentions of anomaly segmentation to some extent. In addition, visual representations are not dependent on language prompts. Given this perspective, a natural question emerges: can an image prompt visual model replace textual prompts vision-language approaches for universal anomaly segmentation? And can such a one-prompt vision model be trained on a non-anomaly segmentation dataset?× × " ! " " # # ! #$% & # # " #$' & # # #$' & Frozen Learnable ℱ % ( & % ) + ()*+(% * ) !"#$(& ! )This paper explores and attempts to answer the above questions. Generally, anomalies mainly include "appearance", "disappearance", and "exchange", which are very similar to the types of changes in change segmentation [60] . Change segmentation aims to identify changes that occur on a pair of images captured at different times. Therefore, anomaly segmentation will be absorbed into change segmentation if we regard normal prompt and query as a pair of images captured at different times. Indeed, one can imagine that if a model is capable of perceiving changes, it would naturally generalize to anomaly segmentation. This simple transformation allows us to achieve universal AS with visual modality alone. This reason is change segmentation does not require anomaly images, as they can be trained using pairs of images containing any changes, which are easily synthesized by available image datasets.Question: Does the paper discuss the limitations of the work performed by the authors?Answer: [Yes] Justification: The limitations of our work is discussed in Section 5.Guidelines:• The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper. • The authors are encouraged to create a separate "Limitations" section in their paper.• The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be. • The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated. • The authors should reflect on the factors that influence the performance of the approach.For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon. • The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size. • If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness. • While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations. 
one-prompt meta-learning for universal anomaly segmentation: 
 Given a change segmentation dataset D base = {X p i , X q i , Y i } i , where (X p i , X q i ) denotes the i-th image pair and Y i is its corresponding change mask. MetaUAS trains a meta-model based on the base set D base and then segments query images {X q i } N i=1 with the corresponding normal image prompt X p i from a novel set D novel , where X p i and X q i belongs to the same class. Note that the base and novel set are non-overlapping (i.e., D base ∩D novel =∅).Overview. As shown in Fig. 1 , our MetaUAS framework is mainly composed of an encoder, a feature alignment module, and a decoder. The encoder extracts hierarchical features using a pre-trained model, while the decoder integrates query and prompt features to predict change heatmap. The feature alignment module is a bridge between the encoder and the decoder. It aligns the query and normal prompt features to address the geometric variation in spatial position. Concretely, for a query image X q and its corresponding prompt image X p (X p and X q ∈ R H×W ×3 ), we parallelly extract muti-scale offline features, {F q l } 5 l=1 and {F p l } 5 l=1 ∈ R h l ×w l ×c l from the encoder, where l denote the l-th stage of the encoder. Then, the feature alignment module independently processes F q l and F p l for aligning query and prompt in feature space at each scale. Next, these aligned features are contacted and fed into the decoder for predicting change heatmaps. The MetaUAS is trained in a meta-learning manner. At inference, given a query image and its normal image prompt, the anomaly mask can be directly predicted. Next, we elaborately introduce them in this section.Encoder. MetaUAS is compatible with any hierarchical architecture. Considering efficiency, we use the standard convolution-based EfficientNet-b4 [57] as our encoder following UniAD [70] . Given a query image X q and its prompt X p , we extract multi-scale features F q l and F p l from the l-th (l = 1, 2, • • • , 5) stage of a pre-trained encoder F(•; θ e ), that isEQUATIONwhere θ e is frozen to sufficiently utilize its generalization because it is pre-trained on a large-scale ImageNet.Feature Alignment Module. We expect to learn a comparison between query and prompt features (F q l and F p l ) for improving change segmentation. A simple and naive manner is to directly contact them along the channel dimension, that isEQUATIONThen, the fused features F l are fed into a decoder to perform change segmentation. This simple fusion manner may only work when the query and its prompt are aligned in pixel space. However, this usually does not hold in practical applications because it is hard to refrain from geometric variations between query and prompt. Therefore, we have to align query and prompt features for better change segmentation. We propose two alignment strategies, hard and soft alignment, for enabling the interaction between query and prompt features.Hard Alignment aims to search the most similar prompt feature at a spatial dimension for each query feature. Here, we take cosine similarity • as a distance measure. Formally, for any query featureEQUATIONwhere (i, j) and (k, l) denote spatial locations. Considering computational efficiency, we use a 1×1 convolution layer Conv(•; θ a ) with shared parameters θ a to reduce the dimension of the channel before computing the cosine similarity, that isEQUATION)Soft Alignment is different from the hard alignment, which aligns each query feature with a weighted combination on the prompt feature. Similar to the hard alignment, we first apply Eq. 4 to reduce computation. The weighted probability is computed with the softmax function on a cross-similarity between the query and prompt features, that isEQUATIONwhere the Softmax operation is applied to the last two dimensions, and thus k l W ijkl = 1.Finally, the aligned prompt feature can be obtained by the weight and original prompt feature, that isEQUATIONThe hard and soft alignment can adaptively align prompt features with query features, and thus handing geometric variation between query and prompt images to some extent. Appling Eqs. 3 or 6, we obtain an aligned prompt feature and then replace the original prompt feature F p l in Eq. 2 with it. Decoder. Considering efficiency, we apply the feature alignment module to three high-level features of prompt and query, and thus three fusion features {F l } 5 l=3 are derived. Change segmentation needs to predict each pixel to determine whether it is changed. Specifically, we utilize UNet [46] G(•; θ g ) as our decoder because it is better suited for tasks requiring high precision and the preservation of fine-grained details. The UNet integrates all three fused features and two low-level original features and produces a final feature at the original image resolution. Finally, a segmentation head transforms the final feature to generate pixel-level change prediction Ŷ . The segmentation head is implemented by a simple 1×1 convolution layer, Conv(•; θ h ), following a sigmoid activation.Remote sensing [7] and street scenes [1] are two main scenarios in change segmentation. They mainly focus on semantic change, and various noises are included in unchanged background regions. Furthermore, the dataset scale is small and the diversity is insufficient. Therefore, it is not suitable for universal change segmentation. Recent works [64, 63, 22] have exploited generative diffusion models to create synthetic datasets and presented a promising performance on real datasets. However, it is hard to guarantee generative annotations are accurate. In contrast, some works have shown that simple synthesis, such as copy-paste, also brings strong performance for instance segmentation [19, 51] and anomaly segmentation [31, 72] . Similar to these works, we want to leverage a synthetic change segmentation dataset with accurate change masks. As early discussed, there are three main change types, "appearance", "disappearance", and "exchange", where "appearance" and "disappearance" are a pair of opposite concepts, and they can be transformed into each other by swapping paired images. Therefore, we only need to synthesize two change types to simulate all three ones. Object-Level Change. In the famous MS-COCO [35] , instances are annotated with polygons, and thus their foreground masks are available. Following CYWS [50] , given a random instance and its binary mask from an image, we could make it disappear from the image by inpainting the mask region [56] . In this simple manner, we can simulate the "disappearance" change. Meanwhile, the change mask is freely available. The "appearance" change can be easily obtained by swapping original and unpainted images. It is challenging to synthesize the "exchange" change because two different instances usually mean different masks. But we can randomly paste an or multiple instances to a given image for rough simulation.Local-Region Change. Object-level changes are generated only by inpainting mask regions or randomly pasting objects as shown in Fig 2.However, anomaly changes are usually diverse, and they may be whole objects or local regions.The local "disappearance" and "appearance" may be failed by inpainting because local regions are easily restored by context. Following DRAEM [72] , we first generate a binary change mask with Perlin noise and then synthesize a new image by filling the mask region with another image pixels. This synthesis can simulate local changes since the binary mask is generated randomly. Given a changed image pair, we apply various data augmentations, such as scale transformations, translation, rotation, and color jittering to enhance the diversity of changes during training phase.Traning. We train MetaUAS in a meta-learning manner, and each meta-task {X p i , X q i , Y i } is one prompt-query pair. The binary cross-entropy loss is adopted to optimize the learnable parameters (θ a , θ g , and θ h ) of MetaUAS, that isEQUATIONInference. For a class-specific query image X q , we first randomly select a normal image prompt X p from the corresponding normal training set and then process prompt-query pairs online to perform anomaly segmentation. For a class-agnostic query image, we need to first construct a class-aware prompt pool {P i } C i=1 via extracting offline features of all normal prompts {X p i } C i=1 in a total of C classes, and then derive the best matching prompt by computing the cosine similarity between the query feature F and the prompt pool. Here, the query and prompt features are obtained by using a global average pooling on the last stage feature from the encoder. Given a query image X q and the corresponding prompt X p , we successively feed them into the encoder, the feature alignment module, the decoder, and the segmentation head, and finally obtain a predicted anomaly map Ŷ . Following previous works, we take the maximum of Ŷ as the image-level anomaly score, without additional post-processing.(a) (b) (c) (d) (e) (f) (g) (a) (b) (c) (d) (e) (f) (g)Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof? Guidelines:• The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.• If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics. • The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction). 
experimental setup: 
 Following previous works, we comprehensively evaluate MetaUAS on three industrial anomaly segmentation benchmarks, MVTec [4] , VisA [78] and Goods [74] . We train a universal change segmentation model on a synthetic dataset. To demonstrate cross-domain generalization ability, we directly test it on three industry anomaly detection benchmarks without fine-tuningCompeting Methods. We compare MetaUAS and its two variants (MetaUAS and MetaUAS +) with diverse state-of-the-art anomaly segmentation methods including zero-shot CLIP [42] , WinCLIP [26] , AnomalyCLIP [76] , and one-shot PatchCore [47] , WinCLIP+ [26] , and fullshot UniAD [70] . MetaUAS segments any anomalies with only one normal image prompt. Here, the one normal prompt is randomly sampled from normal training images for each class. The results are mean and standard deviation based on 5 independent repeated tests with different random seeds.MetaUAS takes the best-matched normal image from the normal training set as the prompt of query image. Here, the matching degree is computed using the cosine similarity between the query image and all normal training images in feature space. MetaUAS + builds on MetaUAS . Following WinCLIP+ [26] , we also add the visual prior knowledge from the image encoder of CLIP model to our MetaUAS for a fair comparison. The visual prior knowledge used in MetaUAS + is kept exactly the same as WinCLIP+.Evaluation Metrics. Following previous works, we use ROC, PR, and F1 max metrics for image-level anomaly classification. Similar to the anomaly classification evaluation, we use the same metrics and additionally report Per-Region Overlap (PRO) for pixel-level anomaly segmentation. We argue that the PR and F1 max metrics are better for anomaly segmentation, where the imbalance issue is very extreme between normal and anomaly pixels [11, 78] .Tables 1 and 2 present the comparison results of MetaUAS with the above-mentioned competing methods in generalization and efficiency, respectively. Generalization. First, MetaUAS with one normal image prompt achieves competitive performance among all zero-, few-and full-shot methods both on MVTec and VisA. This suggests that it is possible to boost anomaly classification and segmentation performance only with visual information alone. But on Goods dataset, MetaUAS seems to perform similarly to other methods. Different from MVTec and VisA, Goods consists of six groups and each group contains dozens or even hundreds of subcategories (484 in total). In fact, it is challenging to address multi-classes with a single model, and the state-of-the-art UniAD is not good even using all normal training images. In contrast, MetaUAS only uses one normal image prompt for each group, which means that the prompt image does not match most query images from multiple subcategories. Furthermore, MetaUAS significantly outperforms almost all competing models when the best-matched normal image is used to take as the normal prompt of each query image. In addition, WinCLIP+ boosts few-shot AS with dense similarity between few-shot prompts and query images. For a fair comparison, we also add the visual prior knowledge from the image encoder of CLIP model to our MetaUAS (denoting as MetaUAS +). We can see that the performance can be further improved when introducing the visual prior of CLIP models to MetaUAS .Efficiency. We measure complexity and efficiency with the number of parameters and forward inference times. The evaluation is performed on one V100 GPU with batch size 32. The number of parameters of WinClIP+ and AnomalyCLIP is 10× and 20× of MetaUAS due to the large visionlanguage backbone. Compared to state-of-the-art, our MetaUAS + achieves the best performance using the single model with half of the parameters and faster inference time. What is more, our MetaUAS has 10× fewer parameters and 100× speed improvement compared to WinCLIP+, which still performs better.Qualitative Comparisons. Figs. A1 and 4 show some selected visualizations from MVTec, VisA, and Goods testing images using the state-of-arts and our MetaUAS. Generally, MetaUAS segments anomalies more accurately and produces fewer false positives. MetaUAS is robust to different image prompts from the same category, especially for those categories with large geometric variations, such as screw. We believe that better performance can be derived if the objects or textures of the prompt image and query images can be roughly aligned. We perform component-wise analysis on MVTec with 256×256 inputs.The influence of feature alignment module. As reported in Tab. 3a, we conduct experiments with combinations of different align strategies and feature fusions. The experimental results demonstrate that using soft alignment is better than the other two ones (no alignment and hard alignment) in the comprehensive results of AC and AS. Moreover, we compare the feature concatenation (Concat) with element-wised addition (Add) and absolute difference (AbsDiff) for aggregating prompt and query features. The Concat operation is the best one. The Add is not suitable to fuse two types of features as it fails to depict the image changes, and it may lead to confusion between these two features, as its results are the worst. The AbsDiff is widely used in the change segmentation field. However, this method may result in the loss of contextual information. In contrast, direct concatenation preserves all information and allows the network to adaptively learn the fusion, yielding the best results.The effects of change types. The diversity of synthetic data is critical for good generalization. We use object-level changes and local region changes to ensure this diversity. Experiments show that object-level changes contribute more performance than local changes in Tab. 3c. This is natural because the object-level change is implemented by inpainting object regions and randomly pasting objects, which has a larger space than local region synthesis. Undoubtedly, combining them further enhances the diversity of synthetic changes, thus further improving performance.Learn or freeze encoder. In Tab. 3b, if we train the encoder like other modules, the performance drops on both AC and AS. We speculate that it makes the network overfit change segmentation dataset, which will degenerate generalization. We also evaluate other backbones, such as EfficientNet-b6 [57] , EfficientViT-b3 [6] , and MobileNetV2 [53] . The EfficientNet-b4 performs better than others. The reason might be that shallow networks cannot extract discriminative features, while deep networks focus more on semantic features. AS requires more structural and texture features.The effects of decoder module. In the decoder, we compare UNet [46] with FPN [34] . U-Net has been widely used and validated in many segmentation tasks due to its effectiveness and efficiency, while FPN is a type of network designed for object detection that requires recognizing objects at various scales. As reported in Tab. 3c, both different types of FPN are worse than UNet.The effects on training samples scale. To investigate the influence of training samples scale on model performance, we conduct experiments with different training subsets where each one is generated by randomly sampling the original training set at various rates, such as {10%, 30%, 50%, 70%, 95%}.The performance of each model on the MVTec testing set is reported in Tab. 3d. It can be seen that MetaUAS still works when the number of training images is small scale (e.g., 50%), and the performance can further improve when increasing the number of training samples. 
conclusion: 
 This paper is the first study to focus on universal anomaly segmentation using pure visual information, enabling the segmenting of unseen anomalies without any training on target anomaly datasets or reliance on language guidance. First, we rethink anomaly segmentation tasks and find they can be unified into change segmentation. This paradigm shift allows us to break away from the persistent challenge of lacking large-scale anomaly segmentation datasets. Naturally, we are capable of leveraging large-scale synthetic image pairs with object-level and local region changes derived from available image datasets. Second, we propose a simple but effective universal anomaly segmentation framework, i.e., MetaUAS. We train MetaUAS in a one-prompt meta-learning manner on this synthesized dataset. To handle geometrical variations between prompt and query images, we propose a soft feature alignment module that bridges paired-image change segmentation and singe-image semantic segmentation. This makes it possible to use sophisticated semantic segmentation modules for change segmentation. MetaUAS achieves a superior generalization using only one normal image prompt on three industrial datasets. Meanwhile, MetaUAS enjoys faster inference speed and fewer parameters. We believe MetaUAS will serve as an alternative to widely used vision-language models for universal anomaly segmentation. Limitation. The performance of MetaUAS can be affected by using inappropriate normal image prompts. In this study, we leverage cosine similarity to identify the most suitable prompts when the category of the query image is unknown. In scenarios involving fine-grained objects, it may be essential to train a classification model to accurately predict the categories of the query images. A Implementation Details.Following UniAD [70] , we extract multi-scale features from all 5 stages of EfficientNet-b4 [57] encoder. In the feature alignment module, the three highest-level features are used to perform queryprompt alignment, and the channel number is reduced to half of one of the original channels before calculating the similarity between query and prompt. Therefore, we derive three aligned features of query and prompt using the feature alignment module. Finally, these three aligned features and two original low-level query features from the first and second stages are fed into the decoder and segmentation head for change segmentation. The model is trained with 30 epochs on 8 Tesla V100 GPUs with batch size 128. We freeze the encoder and optimize the feature alignment module, the decoder, and the segmentation head with AdamW [25] using weight decay 0.0005 and learning rate 0.0001. We conduct experiments based on the open-source framework PyTorch.We follow CYWS [50] and use the same procedure for synthesizing the change segmentation dataset. Specifically, given a labeled image from an existing instance segmentation dataset, i.e., MS-COCO, we randomly selected one or several instances and then could make it disappear from the image by inpainting the mask region [56] . It is worth noting that the binary change mask between the inpainted and original images can be freely available because these selected instances have been manually annotated at the pixel level. We keep the dataset setup as similar to CYWS [50] as possible. Specifically, the change segmentation dataset is synthesized using the randomly selected 60,000 images from the MS-COCO training set. For each image, a synthesized image is generated by inpainting a union mask of a random set of labeled instances. Then, all these 60,000 samples are divided into training and validation sets with a ratio of 0.95:0.05. During training, we randomly employ object-level change and local-region change with a probability of 0.5. 
broader impacts: 
 Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?Answer: [Yes] Justification: Our work will facilitate many applications, such as industrial defect inspection in manufacturing and medical image diagnosis, which is discussed in Section 1.Guidelines:• The answer NA means that there is no societal impact of the work performed.• If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact. • Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations. • The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster. • The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology. • If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML). 
safeguards: 
 Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?Answer: [NA] Justification: Our work poses no such risks.Guidelines:• The answer NA means that the paper poses no such risks.• Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters. • Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images. • We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.12. Licenses for existing assets Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected? Guidelines:• The answer NA means that the paper does not use existing assets.• The authors should cite the original paper that produced the code package or dataset.• The authors should state which version of the asset is used and, if possible, include a URL. • The name of the license (e.g., CC-BY 4.0) should be included for each asset.• For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided. • If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset. • For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided. • If this information is not available online, the authors are encouraged to reach out to the asset's creators. 
new assets: 
 Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?Answer: [NA] Justification: Our work does not release new assets.Guidelines:• The answer NA means that the paper does not release new assets.• Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc. • The paper should discuss whether and how consent was obtained from people whose asset is used. • At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file. 
crowdsourcing and research with human subjects: 
 Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?Answer: [NA] Justification: Our work does not involve crowdsourcing nor research with human subjects.Guidelines:• The answer NA means that the paper does not involve crowdsourcing nor research with human subjects. • Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper. • According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector. 
institutional review board (irb) approvals or equivalent for research with human subjects: 
 Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?Answer: [NA] Justification: Our work does not involve crowdsourcing nor research with human subjects.Guidelines:• The answer NA means that the paper does not involve crowdsourcing nor research with human subjects. • Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper. • We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution. • For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review. 
 
 Appendix: To demonstrate the superiority of MetaUAS, we compare MetaUAS and its variants (MetaUAS and MetaUAS +) with diverse state-of-the-art methods. Implementation and reproduction details are summarized as follows: CLIP [42] is a powerful vision-language model, and it has a strong zero-shot generalization ability.Following previous works, we use two classes of text prompt templates, "A photo of a normal [cls]" and "A photo of an anomalous [cls]", where "cls" denotes the target class name. The anomaly score is computed by cosine similarity between textual features and the class token of a query image. For anomaly segmentation, we extend the above computation from class tokens to local patch tokens.WinCLIP [26] is a zero-shot anomaly segmentation method based on CLIP. A large set of handcrafted textual prompts is designed for anomaly classification. A window scaling strategy is used to obtain better anomaly segmentation. We keep all parameters the same as in their paper. Note that no official implementation of WinCLIP is available, our results are based on an unofficial implementation 1 .WinCLIP+ [26] combines the complementary prediction from both language-guided and visualbased for better anomaly classification and segmentation. The language-guided prediction is the same as WinCLIP. For visual-based prediction, it first simply stores multi-scale features for given few-shot normal images and retrieves the memory features based on the cosine similarity. The final anomaly score is derived by averaging these two scores.AnomalyCLIP [76] learns object-agnostic text prompts that capture generic normality and abnormality in an image regardless of its foreground objects. But AnomalyCLIP requires fine-tuning on an auxiliary domain dataset including normal and anomaly images. AnomalyCLIP is a zero-shot anomaly classification and segmentation method, and it is capable of recognizing any anomalies. We use the official model to report performance for anomaly classification and segmentation.UniAD [70] is a unified unsupervised anomaly segmentation method for addressing multi-classes anomalies with a single model. Different from most zero-/few-shot anomaly segmentation models, UniAD learns feature reconstruction with a transformer-based encoder-decoder architecture on all normal training images. We use the official code to train the specific model for each dataset.PatchCore [47] is a popular unsupervised anomaly classification method that enjoys training-free. For a fair comparison, we modify the official implementation in two folds. First, we replace the original WideResNet-50 backbone with EfficientNet-b4. Second, the memory-bank construction is limited to only one normal image for each class.NeurIPS Paper Checklist Guidelines:• The answer NA means that the abstract and introduction do not include the claims made in the paper. • The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers. • The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings. • It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.https://github.com/zqhang/Accurate-WinCLIP-pytorch 


Decision: This paper proposes to frame anomaly segmentation as a change segmentation task. It proposes a meta-learning approach, trained on a change segentation dataset where image pair changes are artificially created. All Reviewers provided positive feedback for this paper, praising the framing of the problem and the results achieved by the proposed method. Given the unanymous positive feedback received by this paper, I recommend acceptance.

Reviews: review: paper_summary: paper_summary: This paper considers the anomaly segmentation task as a change segmentation task.  Then the large-scale image pairs with object-level and local region changes are synthesized to train a universal anomaly segmentation framework MetaUAS.  This only needs one normal image as the prompt.  The soft feature alignment module is proposed to handle geometrical variations between
prompt and query images.  This method achieves state-of-the-art performance on MVTec AD, VisA, and Goods datasets.
strength_weakness: strength_weakness: 1. The three fused features and two low-level original features are input into decoder. How these features are used in the decoder needs to be explained in more detail.
2. CLIPSeg [1] also uses one image as the prompt to perform segmentation tasks. It is beneficial to discuss and compare with CLIPSeg in this paper.

[1] Lüddecke T, Ecker A. Image segmentation using text and image prompts[C]//Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 2022: 7086-7096.
questions: questions: See the weaknesses.
limitations: limitations: None.
paper_summary: paper_summary: The proposed method reformulates the one-shot anomaly detection task as a change detection task. The proposed method is trained with a synthesitzed change dataset, where objects are added, deleted or exchanged. Additionally, local changes are generated by pasting out-of-distribution textures on images in random locations. The proposed method is trained in a meta-learning manner where each meta-task is a prompt+query pair where a specific change must be detected and accurately segmented. The trained model is applied to industrial anomaly detection, where a single anomaly-free image is used as the prompt while a potentially anomalous image is used as the query. The model must then segment potential changes between the prompt and query image.
strength_weakness: strength_weakness: - Clarity issues in the paper (Exactly how prompt pooling is performed in Section 3.4.)
- The way CLIP is added to the architecture in MetaAS*+ is not clear. 
- Figure 4 - First column and the rest of the figure should be separated better. Currently it seems like the entire row depicts GT masks or queries.
- The evaluation of backbones is limited to convolutional models. The only transformer is used with the MetaAS*+ model.
- MetaAS*+ uses CLIP and achieves the best performance. Why this helps with the one-shot anomaly detection task is not intuitive and a further discussion would be beneficial for the reader.
questions: questions: - Why are only convolutional networks used? Transformer networks should also work well here? A Transformer backbone in the ablation in Table 3b would be nice.
- How is the visual prior from CLIP introduced to the framework. In Table 2 the complexity of MetaAS*+ suggests that Eb4 and ViT are both run but this is not well explained.
- Couldn’t this be extended to the few-shot setup at inference by just adding more prompts and aligning features? If no, why not? If yes, why limit the evaluation to one-shot?
limitations: limitations: The authors have adequately addressed the limitations.
paper_summary: paper_summary: The authors introduce a method for anomaly segmentation that relies solely on visual information and does not require any anomaly training data or language guidance. Their method is based on change segmentation, which allows for the synthesis of large-scale image pairs for training the anomaly segmentation model. The proposed MetaUAS framework demonstrates its generalizability across three industrial anomaly segmentation datasets: MVTec, VisA, and Goods, using one normal image per class as a prompt. Within their framework, the authors extensively experimented with different modules, including an image encoder, feature alignment, and a segmentation decoder. Notably, their feature alignment approach, which is based on a weighted combination of image prompt features, proves to be highly effective for anomaly segmentation by bringing together features of semantic segmentation and change segmentation.
strength_weakness: strength_weakness: - At least one normal image per class is always needed as a prompt to perform anomaly segmentation. All prompts must be processed by the encoder to extract their features, which could become expensive as the number of classes increases.
- The prompt features can be stored offline as a prompt pool to reduce forward passes at test time when using MetaUAS. However, it is unclear whether a single example can represent all normal examples for a class effectively (Figure 4 highlights the issue of different prompts). Searching for the best matching normal image for each query image is obviously resource-intensive.
- The anomalies shown in the industrial datasets relate to small changes in the appearance of the objects. The objects are also always displayed in the same scene. It is noted that the orientation of the object affects the anomaly segmentation performance. To further investigate the limitations, it would be interesting to see what would happen if the scenes changed more dramatically, which is realistic in open-world settings. For example, would MetaUAS be robust if the same normal object were shown with a different background?
- Minor: The paper could benefit from better writing and structure. There are a few typos throughout the text, and the figures and tables could be placed differently. It is not always easy to follow.
questions: questions: - Some more details on the training process would be appreciated. For instance, there is no information on how much training data was required to achieve the presented performance or how robust the model training was. The training data seems to be created in an automated fashion; to what extent does the amount of training data affect the anomaly segmentation performance?
- One could use more than one image as a prompt to potentially obtain more robust anomaly scores. How efficient is the inference? In particular, compared to other existing approaches, could one afford a larger prompt pool or multiple forward passes of MetaUAS?
- Relying on the changes in the visual appearance of objects seems to be a valid approach for anomaly segmentation in industrial settings. The same objects often appear in the same scene, and the anomalies are clear, small visual changes. Therefore, guidance with language seems unnecessary, as the semantic information is not crucial for this kind of anomaly segmentation. However, for other datasets on anomaly segmentation, semantic information seems crucial, such as the [SMIYC](https://segmentmeifyoucan.com/) benchmark, where any obstacle on the road is considered an anomaly. Could MetaUAS also be applied to such more challenging tasks where the normal "object" itself (e.g., the road) could have varying visual appearances as well?
limitations: limitations: The authors have discussed limitations. Potential negative social impact have not been mentioned.
paper_summary: paper_summary: This work presents a novel approach for universal anomaly segmentation (AS) by framing AS as Change segmentation. This change of perspective motivates them to create a synthetic training set based on change detection (e.g. by stitching additional objects from a different dataset). With this synthetic dataset they train a change segmentation model which they later transfer directly for anomaly segmentation without fine-tuning.
strength_weakness: strength_weakness: The paper is confusing at times, with some important concepts not clearly defined:
    - For instance, the different method variants i.e. MetaUAS/MetaUAS*/MetaUAS*+ should be explained more thoroughly in the methodology section. 
    - Also there should be consistency in the naming (MetaUAS vs MetaAS). 
    - The highlighted numbers (red and blue) in the tables are excluding UniAD in Table 1 (which is marked in gray) and I could not find out why.

Missing comparison with change segmentation methods. The paper proposes that AS can be tackled as change segmentation between one normal (reference) image and the query image with the anomaly, which sounds reasonable. However, I would expect then that existing Change Segmentation methods could be applied to AS (just like authors do with their method). Thus, it would be sensible to include a comparison with one or two baselines of recent change segmentation methods applied to AS the same way that MetaUAS is applied.
questions: questions: Can the authors explain what are the differences between MetaUAS/*/*+ ?

Why is UniAD excluded from the comparison in Table1?

Could all change segmentation methods be applied to anomaly segmentation "off-the-shelf"? If yes, why not include some existing methods as baseline? If no, please explain what are the particular differences that make MetaUAS applicable to AS while other change segmentation methods can not.
limitations: limitations: Limitations and social impact are well addressed.

Comments: title: Response to Reviewer Concerns on Few-Shot MetaUAS*
Thank you for the authors response
Response to Reviewer Concerns on Robustness
Response to Author Rebuttal
comment: We are pleased to hear that our rebuttal has addressed most of your concerns, and we appreciate your continued engagement in this discussion. In response to your interest in the few-shot MetaUAS*, we have included the results in the table below.

|Shot |I-ROC |I-PR |P-ROC |P-PR |P-PRO|
| :---: | :---: | :---: | :---: | :---: | :---: |
|1	 |94.2 |97.6 |95.3  |63.7  |83.1|
|3      |95.0 |98.0 |96.2  |66.0  |85.9|
|5	 |**95.2** |**98.1** |**96.4**  |**66.4**  |**86.4**|

It is important to note that the one-shot MetaUAS* is based on the best-matched normal image prompt. Consequently, for the 3-shot and 5-shot MetaUAS*, we utilized the top 3 and top 5 normal image prompts, respectively. As shown, the performance trend of MetaUAS* is similar to that of MetaUAS (gb5F-Q3) as the shot number of normal image prompts increases.

We acknowledge that our current extension from one-shot to few-shot is quite straightforward. We consider it a preliminary approach, leaving room for future work.

Thank you for your feedback.
Thanks for the insightful rebuttal. The adaptation to the few-shot scenario is interesting. It would also be interesting to see the performance of the MetaUAS* on the few-shot setup due to the difference in performance to MetaUAS in the one-shot scenario. But otherwise my concerns have been addressed.
Thanks for the efforts in the rebuttal. I will maintain my score.
The author response clarified my questions and after reading the other reviewers comments I will increase my score to weak accept.
Thank you for your thoughtful feedback and for maintaining your rating (**Accept**). We appreciate your recognition of the novelty and interest in our work. We understand your concerns regarding the robustness of our method to different normal image prompts and would like to address these as follows to clarify our approach further.

Firstly, as demonstrated in Figure 4, our MetaUAS shows robustness to different normal image prompts within the same category, particularly in those categories with significant geometric variations, such as grid and screw. This indicates that our method can effectively handle different prompts within the same category. 

Secondly, to quantitatively evaluate the robustness of our MetaUAS, we report performance metrics including the mean and variance based on the results from five different normal image prompts (generated with random seeds). It can be observed that our MetaUAS achieves higher means and lower variances compared to WinCLIP+ across most metrics, demonstrating its superior stability.

Lastly, we have found that matching the optimal prompt (as shown in MetaUAS* in Table 1) or using few-shot normal prompts (e.g., 5-shot) can further result in significant performance improvements or enhance robustness (as detailed in the gb5F-Q3). 

We hope these explanations adequately address your concerns regarding the robustness of our method. We are grateful for the opportunity to discuss these aspects further and thank you once again for your valuable feedback.
Thank the authors for their response. I'm inclined to keep my rating. This is a very interesting and novel paper, but this method does not seem to be very robust to different normal image prompts, which makes it impossible to continue to improve the rating to Strong Accept.