异常检测 相关工作anomaly detection related work 汇总

1.2024 CVPR Supervised Anomaly Detection for Complex Industrial Images

会议 2024 CVPR
paper https://arxiv.org/pdf/2405.04953
Code https://github.com/abc-125/segad

摘要
Automating visual inspection in industrial production lines is essential for increasing product quality across various industries. Anomaly detection (AD) methods serve as robust tools for this purpose. However, existing public datasets primarily consist of images without anomalies,limiting the practical application of AD methods in production settings. To address this challenge, we present (1) the Valeo Anomaly Dataset (VAD), a novel real-world industrial dataset comprising 5000 images, including 2000
instances of challenging real defects across more than 20 subclasses. Acknowledging that traditional AD methods struggle with this dataset, we introduce (2) Segmentationbased Anomaly Detector (SegAD). First, SegAD leverages anomaly maps as well as segmentation maps to compute local statistics. Next, SegAD uses these statistics and an optional supervised classifier score as input features for a Boosted Random Forest (BRF) classifier, yielding the final anomaly score. Our SegAD achieves state-of-the-art performance on both VAD (+2.1% AUROC) and the VisA dataset (+0.4% AUROC). The code and the models are publicly available1.
在工业生产线中自动化视觉检测对于提高各个行业的产品质量至关重要。异常检测(AD)方法为此目的提供了强大的工具。然而,现有的公共数据集主要由没有异常的图像组成,这限制了AD方法在生产环境中的应用。为了应对这一挑战,我们提出了(1)Valeo异常数据集(VAD),这是一个包含5000张图像的新型真实世界工业数据集,其中包括2000个跨越20多个子类别的具有挑战性的真实缺陷实例。认识到传统的AD方法在处理这个数据集时存在困难,我们引入了(2)基于分割的异常检测器(SegAD)。首先,SegAD利用异常图和分割图来计算局部统计数据。接下来,SegAD使用这些统计数据和一个可选的监督分类器分数作为输入特征,为增强随机森林(BRF)分类器提供输入,从而得出最终的异常分数。我们的SegAD在VAD(+2.1% AUROC)和VisA数据集(+0.4% AUROC)上都取得了最先进的性能。代码和模型都是公开可用的。

2. 相关工作

在本节中,我们首先讨论现有数据集并解释VAD的不同之处。接下来,我们对现有异常检测方法进行简要概述。我们在表1中展示了我们的VAD与现有数据集之间的全局比较。

2.1. 数据集

2019年,引入了MVTec AD数据集。与早期主要包含纹理和简单缺陷的数据集相比,该数据集通过提供带有真实缺陷和现实物体的图像,极大地推动了异常检测方法的发展。MVTec LOCO AD强调了逻辑缺陷(如缺失或错位部件)的挑战,这需要异常检测方法能够捕捉图像的全局上下文。更近的VisA数据集在此基础上进行了扩展,纳入了具有复杂结构、多个实例和尺度变化的多样物体。

现有数据集通常包含模拟缺陷,这在研究和实际应用之间造成了域差距。这使得异常检测方法在现实世界中的部署变得复杂。为了促进有监督的异常检测,我们提出了Valeo异常数据集(VAD),这是一个具有各种缺陷(包括逻辑缺陷)的真实世界工业数据集。

另一个值得注意的问题源于已解决数据集的饱和,其他方法更多地受到数据集特定设计选择的影响,而不是普遍适用性。相比之下,我们的数据集引入了更广泛的具有挑战性和多样性的异常,以及良好图像的高类内变异性。

2.2. 方法

为了定义我们正在使用的术语,在异常检测的背景下,“单类”方法通常被称为无监督方法。我们使用“单类”作为更准确的名称,因为这些方法使用标记图像进行训练。重要的是要将此类方法与处理未标记数据的方法区分开来。使用好坏图像进行训练的模型通常被称为“有监督”,这也是我们采用的名称。

One-class Anomaly Detection. PatchCore [27] relies on a pretrained feature extractor model to extract features from the training set into a memory bank and reduce the size of a memory bank using coreset subsampling. Features extracted from the new input are compared to their nearest neighbors in the memory bank. FastFlow [34] uses a similar feature extractor model and maps extracted features to the Gaussian distribution using normalizing flow [26]. RD4AD [8] utilizes a teacher-student architecture, which combines features from several layers of feature extractor to eliminate redundant ones. EfficientAD [2] introduces many innovations, including using an autoencoder to detect logical defects as an addition to a classic teacher-student architecture and their own pretrained feature extractor, which imitates the behavior of a bigger model with a noticeably lesser inference time.
单类异常检测。PatchCore依赖于预训练的特征提取器模型,将训练集中的特征提取到记忆库中,并使用核心集子采样减少记忆库的大小。从新输入中提取的特征与记忆库中的最近邻进行比较。FastFlow使用类似的特征提取器模型,并使用归一化流将提取的特征映射到高斯分布。RD4AD利用师生架构,该架构结合了来自特征提取器多个层的特征以消除冗余特征。EfficientAD引入了许多创新,包括使用自动编码器检测逻辑缺陷,作为经典师生架构的补充,以及他们自己的预训练特征提取器,其以明显更短的推理时间模仿更大模型的行为。

Supervised Anomaly Detection. In theory, leveraging defective parts for training is advantageous for refining class boundaries [28]. However, practical challenges arise, such as the small size of anomalies and the impossibility of collecting all potential defects [37]. Several recent anomaly detection methods use both good and bad images [24, 33, 37], but some of them overfit to seen defects, and others require pixel masks for defects to calculate loss or to generate new defects, which can be problematic in a real-world case. Real-world datasets (as VAD) might contain logical defects that cannot be generated by existing defects generation strategies, which usually cut and paste existing defects with various modifications [33, 37], which is not going to improve results for a wrong wire shape as or other similar types of defects.
有监督异常检测。理论上,利用缺陷部分进行训练有利于细化类边界。然而,实际挑战也随之而来,例如异常的大小较小以及无法收集所有潜在缺陷。最近的一些异常检测方法同时使用好坏图像,但其中一些方法对已见缺陷过拟合,而其他方法需要缺陷的像素掩码来计算损失或生成新缺陷,这在实际情况中可能会有问题。现实世界数据集(如VAD)可能包含逻辑缺陷,这些缺陷无法通过现有缺陷生成策略生成,现有策略通常是对现有缺陷进行剪切和粘贴并进行各种修改,这对于错误的电线形状或其他类似类型的缺陷不会提高结果。
Very few supervised anomaly detection benchmarks are available; the most popular is Supervised Anomaly Detection on MVTec AD. DevNet [24] is one of the first supervised anomaly detection models that tried to solve industrial MVTec AD dataset, compared to earlier methods which were mostly addressing Out-of-Distribution problem [13, 28] using non-industrial datasets such as MNIST [16] or CIFAR-10 [15]. DRA [9] uses several heads to learn both seen and pseudo anomalies, as well as normal examples, which should reduce overfitting on seen anomalies. These methods perform well on MVTec AD but might fail on more complex problems, as shown in Tab. 3 and Tab. 5. Compared to modern supervised anomaly detection methods, SegAD (ours) performs better than current SOTA methods, even on complex problems without pixel-level labels, extensive augmentation, and long training.
可用的有监督异常检测基准非常少;最流行的是在MVTec AD上的有监督异常检测。DevNet是最早尝试解决工业MVTec AD数据集的有监督异常检测模型之一,与早期主要使用非工业数据集(如MNIST或CIFAR - 10)解决分布外问题的方法相比。DRA使用多个头来学习已见和伪异常以及正常示例,这应该可以减少对已见异常的过拟合。这些方法在MVTec AD上表现良好,但在更复杂的问题上可能会失败,如表3和表5所示。与现代有监督异常检测方法相比,SegAD(我们的)即使在没有像素级标签、大量增强和长时间训练的复杂问题上,也比当前的SOTA方法表现更好。

2.2024 CVPR Toward Generalist Anomaly Detection via In-context Residual Learning with Few-shot Sample Prompts

会议
2024 CVPR
paper
https://arxiv.org/pdf/2403.06495
Code
https://github.com/mala-lab/InCTRL
摘要
This paper explores the problem of Generalist Anomaly Detection (GAD), aiming to train one single detection model that can generalize to detect anomalies in diverse datasets from different application domains without any further training on the target data. Some recent studies have shown that large pre-trained Visual-Language Models (VLMs) like CLIP have strong generalization capabilities on detecting industrial defects from various datasets, but their methods rely heavily on handcrafted text prompts about defects, making them difficult to generalize to anomalies in other applications, e.g., medical image anomalies or semantic anomalies in natural images. In this work, we propose to train a GAD model with few-shot normal images as sample prompts for AD on diverse datasets on the fly. To this end, we introduce a novel approach that learns an incontext residual learning model for GAD, termed InCTRL. It is trained on an auxiliary dataset to discriminate anomalies from normal samples based on a holistic evaluation of the residuals between query images and few-shot normal sample prompts. Regardless of the datasets, per definition of anomaly, larger residuals are expected for anomalies than normal samples, thereby enabling InCTRL to generalize across different domains without further training. Comprehensive experiments on nine AD datasets are performed to establish a GAD benchmark that encapsulate the detection of industrial defect anomalies, medical anomalies, and semantic anomalies in both one-vs-all and multi-class setting, on which InCTRL is the best performer and significantly outperforms state-of-the-art competing methods. Code is available at https://github.com/mala-lab/InCTRL.
本文探讨了通用异常检测(GAD)问题,旨在训练一个单一的检测模型,该模型无需在目标数据上进行任何进一步训练,就能对来自不同应用领域的各种数据集进行异常检测。最近的一些研究表明,像CLIP这样的大型预训练视觉 - 语言模型(VLMs)在检测来自各种数据集的工业缺陷方面具有很强的泛化能力,但它们的方法在很大程度上依赖于关于缺陷的手工制作的文本提示,这使得它们难以推广到其他应用中的异常情况,例如医学图像异常或自然图像中的语义异常。在这项工作中,我们提出利用少量正常图像作为多样数据集上的异常检测(AD)的样本提示来训练一个GAD模型。为此,我们引入了一种新的方法,即为GAD学习一个上下文内残差学习模型,称为InCTRL。它在辅助数据集上进行训练,基于对查询图像和少量正常样本提示之间残差的整体评估来区分异常和正常样本。无论数据集如何,根据异常的定义,异常的残差预计会比正常样本大,从而使InCTRL能够在不进行进一步训练的情况下跨不同领域进行泛化。我们在九个AD数据集上进行了综合实验,以建立一个GAD基准,该基准涵盖了在一对多和多类设置下的工业缺陷异常检测、医学异常检测和语义异常检测,InCTRL在这些实验中表现最佳,显著优于最先进的竞争方法。代码可在https://github.com/mala-lab/InCTRL获取。

2. 相关工作

2.1异常检测

异常检测。现有的异常检测方法通常依赖于无监督学习,这是由于异常数据较为稀缺。已经有许多方法被提出。**单类分类方法[6, 15, 42, 49, 67]专注于用支持向量紧凑地描述正常数据。基于重建的方法[2, 22, 32, 39, 44, 61, 64 - 66, 68 - 70]训练模型来重建正常图像,其中异常通过较高的重建误差来识别。基于距离的方法[16, 17, 41]根据测试图像嵌入与存储的训练数据中的正常参考嵌入之间的距离来确定异常。****知识蒸馏方法[8, 11, 19, 43, 52, 53, 71]专注于从预训练模型中提取正常模式,并根据蒸馏特征和原始特征之间的差异检测异常。**上述方法旨在针对目标数据集进行异常检测模型的拟合,即一个模型对应一个数据集。而我们的目标是实现一个通用模型的设置。一个相关的研究方向是解决领域或分布偏移下的异常检测问题[1, 11, 20, 34, 66, 74],但它们通常假设源数据和目标数据具有较大的领域相关性。此外,已经有许多同时进行的研究利用视觉语言模型(VLM)进行异常检测[59, 60, 73],但它们解决的问题设置与我们不同,例如弱监督异常检测[59, 60]或零样本异常检测[73]。

少样本异常检测(FSAD)。FSAD旨在仅使用目标数据集中有限数量的正常样本识别异常。传统的FSAD研究侧重于对这些少量正常样本的正态分布进行建模以检测异常[5, 23, 30, 45, 46, 57, 58, 62]。然而,这些方法通常无法推广到新的领域,因为它们通常需要使用目标数据集中的正常数据进行重新训练或微调。

基于距离的方法,如SPADE[16]、PaDiM[17]和PatchCore[41],通过充分利用少量样本的可用预训练表示来计算基于距离的异常分数而无需训练,从而提供了一种解决该问题的方案。最近,RegAD[23]被设计为一种在FSAD任务中无需对新数据进行训练或微调即可运行的模型,但它需要训练数据和测试数据之间具有领域相关性才能良好工作。WinCLIP[25]率先将大型视觉语言模型(VLM)应用于零样本和少样本异常检测任务,通过对图像进行多尺度窗口移动处理并向CLIP提供文本提示。在不使CLIP适应异常检测任务的情况下,WinCLIP使用其手工制作的文本提示在缺陷数据集上获得了令人印象深刻的零样本检测性能,但当文本提示无法捕捉到所需的异常语义时,它就无法很好地工作,这使得它难以很好地推广到各种异常检测任务。

2.2上下文学习

上下文学习是一种创新方法,有助于提高大语言模型(LLM)在自然语言处理(NLP)中的性能[3, 9, 21],它利用最少的上下文提示有效地使LLM适应新任务。

最近,一些研究[13, 14, 26, 33, 54]试图将上下文学习应用于视觉任务,方法是使用语言或专门设计的离散标记作为任务提示将视觉问题转换为NLP问题。另一方面,Amir等人[4]引入了一种用于上下文视觉提示的新方法,将一系列视觉任务视为网格修复问题。类似地,Painter[55, 56]随后提出执行掩码图像修复。然而,这些方法更侧重于任务级别的泛化,因此不适用于更侧重于实例级差异的异常检测任务。

我们的工作重新设计了用于通用异常检测(GAD)的上下文学习。我们将图像提示重新定义为特定于数据集的正常模式,而不是特定任务的指令。通过捕捉查询图像和少量正常提示之间的上下文残差,我们的模型可以对各种异常获得一致的理解,从而为GAD实现卓越的广义检测性能。

3.2024 ECCV Hierarchical Gaussian Mixture Normalizing Flow Modeling for Unified Anomaly Detection

会议
2024 ECCV
paper
https://www.ecva.net/papers/eccv_2024/papers_ECCV/papers/04634.pdf
Code
https://github.com/xcyao00/HGAD
摘要
Unified anomaly detection (AD) is one of the most valuable challenges for anomaly detection, where one unified model is trained with normal samples from multiple classes with the objective to detect anomalies in these classes. For such a challenging task, popular normalizing flow (NF) based AD methods may fall into a “homogeneous mapping” issue, where the NF-based AD models are biased to generate similar latent representations for both normal and abnormal features, and thereby lead
to a high missing rate of anomalies. In this paper, we propose a novel Hierarchical Gaussian mixture normalizing flow modeling method for accomplishing unified Anomaly Detection, which we call HGAD. Our HGAD consists of two key components: inter-class Gaussian mixture modeling and intra-class mixed class centers learning. Compared to the previous NF-based AD methods, the hierarchical Gaussian mixture modeling approach can bring stronger representation capability to the latent space of normalizing flows. In this way, we can avoid mapping different class distributions into the same single Gaussian prior, thus effectively avoiding or mitigating the “homogeneous mapping” issue. We further
indicate that the more distinguishable different class centers, the more conducive to avoiding the bias issue. Thus, we further propose a mutual information maximization loss for better structuring the latent feature space. We evaluate our method on four real-world AD benchmarks, where we can significantly improve the previous NF-based AD methods and also outperform the SOTA unified AD methods.
统一异常检测 (AD) 是异常检测最有价值的挑战之一,其中使用来自多个类别的正常样本训练一个统一模型,目的是检测这些类别中的异常。对于这样一项具有挑战性的任务,流行的基于归一化流程 (NF) 的 AD 方法可能会陷入“同质映射”问题,其中基于 NF 的 AD 模型会偏向于为正常和异常特征生成相似的潜在表示,从而导致异常的高缺失率。在本文中,我们提出了一种新的分层高斯混合归一化流建模方法,用于完成统一的异常检测,我们称之为 HGAD。我们的 HGAD 由两个关键部分组成:类间高斯混合建模和类内混合类中心学习。与以往基于 NF 的 AD 方法相比,分层高斯混合建模方法可以为归一化流的潜在空间带来更强的表示能力。通过这种方式,我们可以避免将不同的类分布映射到同一个高斯先验中,从而有效地避免或缓解 “齐次映射” 问题。我们进一步指出,不同的类中心越容易区分,就越有利于避免偏差问题。因此,我们进一步提出了一种互信息最大化损失,以更好地构建潜在特征空间。我们根据四个真实世界的 AD 基准评估了我们的方法,在这些基准测试中,我们可以显着改进以前基于 NF 的 AD 方法,并且性能优于 SOTA 统一 AD 方法。

Anomaly Detection.

  1. Reconstruction-based approaches are the most popular AD methods. These methods rely on the assumption that models trained by normal samples would fail in abnormal image regions. Many previous works attempt to train AutoEncoders [18, 37], Variational AutoEncoders [16] and GANs [2, 25] to reconstruct the input images. However, these methods facethe “identical shortcut” problem [35].
    • 基于重建的方法:是最流行的异常检测方法。这些方法依赖于这样的假设,即由正常样本训练的模型在异常图像区域会失效。许多先前的工作尝试训练自动编码器、变分自动编码器和生成对抗网络来重建输入图像。然而,这些方法面临 “相同捷径” 问题。
  2. Embedding-based approaches recently show better AD performance by using ImageNet pre-trained networks as feature4 Yao et al. extractors [3, 8]. PaDiM [9] extract pre-trained features to model Multivariate Gaussian distribution for normal samples, then utilize Mahalanobis distance to measure the anomaly scores. PatchCore [20] extends on this line by utilizing locally aggregated features and introducing greedy coreset subsampling to form nominal feature banks.
    • 基于嵌入的方法:最近通过使用ImageNet预训练网络作为特征提取器表现出更好的异常检测性能。PaDiM提取预训练特征以对正常样本的多元高斯分布进行建模,然后利用马氏距离来测量异常分数。PatchCore在此基础上进行了扩展,利用局部聚合特征并引入贪婪核心集子采样来形成名义特征库
  3. Knowledge distillation assumes that the student trained to learn the teacher on normal samples could only regress normal features but fail in abnormal features [5]. Recent works mainly focus on feature pyramid [24, 31], reverse distillation [10], and asymmetric distillation [23].
    • 知识蒸馏:假设在正常样本上学习教师模型的学生只能回归正常特征而在异常特征上失败。最近的工作主要集中在特征金字塔、反向蒸馏和非对称蒸馏上。
  4. Unified AD approaches attempt to train a unified AD model to accomplish anomaly detection for multiple classes. UniAD [35], PMAD [34] and OmniAL [41] are three existing methods in this new direction. UniAD is a transformer-based reconstruction model with three improvements, it can perform well under the unified case by addressing the “identical shortcut” issue. PMAD is a MAE-based patch-level reconstruction model, which can learn a contextual inference relationship within one image rather than the class-dependent reconstruction mode. OmniAL is a unified CNN
    framework with anomaly synthesis, reconstruction and localization improvements
    • 统一异常检测方法:试图训练一个统一的异常检测模型来完成多类异常检测。UniAD、PMAD和OmniAL是这个新方向上的三种现有方法。UniAD是一种基于变压器的重建模型,有三个改进之处,通过解决 “相同捷径” 问题,它在统一情况下可以表现良好。PMAD是一种基于MAE的补丁级重建模型,它可以在一幅图像内学习上下文推理关系,而不是类依赖的重建模式。OmniAL是一个具有异常合成、重建和定位改进的统一CNN框架。

GMM in Anomaly Detection. Previous methods, DAGMM [38] and PEDENet [40], also utilize GMM for anomaly detection. However, our method is significantly different from these methods as follows: 1) Different Task. DAGMM
is used for non-image data, and PEDENet is used for one-for-one image anomaly detection. Although they both use GMM, it’s nontrivial to use them for unified anomaly detection. However, our method can achieve superiority in the unified AD task. 2) Different Approach. DAGMM and PEDENet both predict membership and then use the predicted membership and GMM modeling formulas to directly calculate the mixture component weights and the mean and variance of each mixture component. Our method is based on the learnable class centers and class weights. The way of ours is more beneficial for the hierarchical Gaussian mixture modeling while the way in DAGMM and PEDENet is difficult to achieve this.

  • 异常检测中的高斯混合模型:先前的方法DAGMM和PEDENet也利用高斯混合模型进行异常检测。然而,我们的方法与这些方法有显著不同,具体如下:
    • 不同任务:DAGMM用于非图像数据,PEDENet用于一对一的图像异常检测。尽管它们都使用高斯混合模型,但将它们用于统一异常检测并非易事。然而,我们的方法可以在统一异常检测任务中取得优势。
    • 不同方法:DAGMM和PEDENet都预测成员资格,然后使用预测的成员资格和高斯混合模型建模公式直接计算混合成分权重以及每个混合成分的均值和方差。我们的方法基于可学习的类中心和类权重。我们的方法更有利于分层高斯混合建模,而DAGMM和PEDENet中的方法难以实现这一点。
      Normalizing Flows in Anomaly Detection. In anomaly detection, normalizing flows are employed to learn the normal data distribution [12,15,21,33,36], which maximize the log-likelihoods of normal samples during training. Rudolph
      et al. [21] first employ NFs for anomaly detection by estimating the distribution of pre-trained features. In CFLOW-AD [12], the authors further construct NFs on multi-scale feature maps to achieve anomaly localization. Recently, fully convolutional normalizing flows [22,36] have been proposed to improve the accuracy and efficiency of anomaly detection. In BGAD [33], the authors propose a NF-based AD model to tackle the supervised AD task. In this paper, we mainly propose a novel NF-based AD model (HGAD) with three improvements to achieve much better unified AD performance.
  • 异常检测中的归一化流:在异常检测中,归一化流用于学习正常数据分布,在训练期间最大化正常样本的对数似然。Rudolph等人首先使用归一化流进行异常检测,通过估计预训练特征的分布。在CFLOW - AD中,作者进一步在多尺度特征图上构建归一化流以实现异常定位。最近,全卷积归一化流被提出以提高异常检测的准确性和效率。在BGAD中,作者提出了一种基于归一化流的异常检测模型来处理监督异常检测任务。在本文中,我们主要提出了一种新颖的基于归一化流的异常检测模型(HGAD),具有三个改进之处,以实现更好的统一异常检测性能。

4.2024 ECCV GeneralAD: Anomaly Detection Across Domains by Attending to Distorted Features

会议
2024 eccv
Paper
https://www.ecva.net/papers/eccv_2024/papers_ECCV/papers/05481.pdf
Code
https://github.com/LucStrater/GeneralAD
摘要
In the domain of anomaly detection, methods often excel in either high-level semantic or low-level industrial benchmarks, rarely achieving cross-domain proficiency. Semantic anomalies are novelties that
differ in meaning from the training set, like unseen objects in self-driving cars. In contrast, industrial anomalies are subtle defects that preserve semantic meaning, such as cracks in airplane components. In this paper, we present GeneralAD, an anomaly detection framework designed to operate in semantic, near-distribution, and industrial settings with minimal per-task adjustments. In our approach, we capitalize on the inherent design of Vision Transformers, which are trained on image patches, thereby ensuring that the last hidden states retain a patch-based structure. We propose a novel self-supervised anomaly generation module that employs straightforward operations like noise addition and shuffling to patch features to construct pseudo-abnormal samples. These features are fed to an attention-based discriminator, which is trained to score every patch in the image. With this, our method can both accurately identify anomalies at the image level and also generate interpretable anomaly maps. We extensively evaluated our approach on ten datasets, achieving state-of-the-art results in six and on-par performance in the remaining for both localization and detection tasks.
在异常检测领域,方法通常在高级语义或低级工业基准方面表现出色,很少达到跨域熟练程度。语义异常是含义与训练集不同的新奇事物,例如自动驾驶汽车中看不见的对象。相比之下,工业异常是保留语义含义的细微缺陷,例如飞机部件中的裂纹。在本文中,我们提出了 GeneralAD,这是一个异常检测框架,旨在以最少的每次任务调整在语义、近分布和工业环境中运行。在我们的方法中,我们利用了 Vision Transformers 的固有设计,这些 Transformer 在图像补丁上进行了训练,从而确保最后的隐藏状态保持基于补丁的结构。我们提出了一种新的自监督异常生成模块,该模块采用简单的操作,如噪声添加和洗牌来修补特征来构建伪异常样本。这些特征被馈送到一个基于注意力的判别器,该判别器经过训练,对图像中的每个补丁进行评分。有了这个,我们的方法既可以准确识别图像级别的异常,又可以生成可解释的异常图。我们在 10 个数据集上广泛评估了我们的方法,在 6 个数据集中取得了最先进的结果,在其余数据集中,定位和检测任务的性能都达到了同等水平。

相关工作

异常检测涵盖了各种类型的不规则性,传统上每种类型都需要特定的检测方法。在本节中,我们将展示与我们工作相关的不同领域,并讨论相关方法。
2 Related Work
Anomaly detection encompasses various types of irregularities, each traditionally requiring specific detection methods. In this section we show the distinct areas that intersect in our work and discuss related methods.

2.1语义异常检测

语义环境中的方法旨在识别在语义上偏离训练数据分布的新颖性。当评估数据集中正常分布和异常分布之间的偏差较大时,这被称为异常检测任务,如在CIFAR - 10数据集中所见。相反,如果偏差较小,则称为近异常检测,例如由Aircraft - FGVC数据集[33]所例证的。该领域的常见解决方案包括自监督学习方法[18, 22, 38, 44]和利用预训练模型的特征[11, 33, 37, 42]。例如,Transformaly[11]扩展了KDAD[42]中提出的学生 - 教师架构,并在语义异常检测基准上取得了最先进的结果**。FYTIMI[33]是近语义异常检测的最先进方法,它使用扩散模型[23]生成伪异常,然后用于解决正常数据集和生成的异常输入之间的二分类任务。**尽管这些方法在语义数据集上取得了优异的结果,但它们检测补丁级异常(缺陷)的能力有限,导致在工业基准上表现不佳。

2.1 Semantic Anomaly Detection.
Methods in the semantic setting are designed to identify novelties that deviate semantically from the training data distribution. When the deviation between the normal and abnormal distributions in the evaluation dataset is large, it is
referred to as an anomaly detection task, as seen in the CIFAR-10 dataset. Conversely, if the deviation is small, it is termed near anomaly detection, exemplified by the Aircraft-FGVC dataset [33]. Common solutions in this domain
include self-supervised learning methods [18, 22, 38, 44] and leveraging features from pretrained models [11, 33, 37, 42]. Transformaly [11], for instance, extends the student-teacher architecture proposed in KDAD [42] and achieves state-ofthe-art results on semantic anomaly detection benchmarks. FYTIMI [33], the state-of-the-art in near semantic anomaly detection, uses diffusion models [23] to generate pseudo-anomalies, which are then used to solve a binary classification task between the normal dataset and the generated abnormal inputs. Although these methods have achieved superior results on semantic datasets, their ability to detect patch-level anomalies (defections) is limited, resulting in poor performance on industrial benchmarks.

2.2工业异常检测

工业环境中的方法使用完整的训练样本来在测试期间识别缺陷。它通常侧重于细粒度异常,其中图像中只有小部分与正常不同。这将其与语义和近异常检测区分开来,在后两者中异常跨越整个图像。主要有两种方法:基于合成的[28, 48]和基于嵌入的[2, 6, 12, 14, 20, 21, 37, 39, 46]方法。基于合成的方法试图通过采用增强[28]或特征空间操作来近似异常分布,以促进检测任务[30]。基于嵌入的方法,如Recontrast[21]和PatchCore[39],侧重于将正常图像特征转换到一个异常突出的空间。虽然这些方法在识别像素级异常方面表现出色,但在检测语义异常方面效果较差。例如,SimpleNet[30]是该基准的最先进模型,旨在仅在局部补丁级别检测异常。因此,它缺乏对补丁之间的互相关进行建模所需的全局视角,而这对于有效的语义异常检测至关重要。然而,GeneralAD旨在不仅在补丁级别检测异常,还通过识别补丁特征之间的异常相关性来检测异常。这种能力使其成为各种类型异常的通用解决方案。
2.2 Industrial Anomaly Detection.
Methods in the industrial setting use intact training samples to identify defects during testing. It typically focuses on fine-grained anomalies, where only small parts of an image differ from the norm. This distinguishes it from semantic and
near anomaly detection, where anomalies span the entire image. There are two main approaches: synthesizing-based [28, 48] and embedding-based [2, 6, 12, 14,20,21,37,39,46], methods. Synthesizing-based methods attempt to approximate
4 L.P.J. Sträter et al.
the abnormal distribution by employing augmentations [28] or feature space
manipulation to facilitate the detection task [30]. Embedding-based methods,
such as Recontrast [21] and PatchCore [39], focus on transforming normal image
features into a space where anomalies stand out. While these approaches excel
at identifying pixel-level anomalies, they are less effective at detecting semantic
ones. For instance, SimpleNet [30], the state-of-the-art model for this benchmark,
is designed to detect anomalies only at the level of local patches. Consequently,
it lacks a global perspective necessary for modeling cross-correlations between
patches, which is essential for effective semantic anomaly detection. GeneralAD,
however, is designed to detect anomalies not only at the patch level but also by
identifying abnormal correlations between patch features. This capability makes
it a versatile solution for various types of anomalies.

2.3自监督异常检测

自监督学习方法已被应用于检测语义异常[5, 18, 22, 38, 44]和工业异常[28, 30]。然而,代理任务的设置方式因所针对的异常类型而异。对于语义异常,代理任务通常涉及学习捕获正常数据分布的高级特征,例如通过旋转预测[18]、扰动预测[5]或对比学习[44]。另一方面,对于工业异常,代理任务通常侧重于学习对局部不规则性敏感的低级特征,例如通过基于补丁的掩蔽[28]。GeneralAD旨在预测预训练特征是否已被编辑,编辑操作集根据要检测的异常类型进行定制。
2.3 Self-supervised Anomaly Detection
Self-supervised learning approaches have been applied to detect both semantic
anomalies [5, 18, 22, 38, 44] and industrial anomalies [28, 30]. However, the way
the proxy task is set up differs depending on the type of anomaly being targeted.
For semantic anomalies, the proxy task often involves learning high-level features
that capture the normal data distribution, such as through rotation prediction
[18], perturbation prediction [5] or contrastive learning [44]. On the other hand,
for industrial anomalies, the proxy task typically focuses on learning low-level
features that are sensitive to local irregularities, such as through patch-based
masking [28]. GeneralAD is designed to predict whether pretrained features have
been edited, with the set of editing operations tailored to the type of anomaly
to be detected.

### Hyperledger Fabric Token Contract Implementation and Usage In the context of blockchain technology, particularly within platforms like Hyperledger Fabric, implementing token contracts involves several key components including defining assets, transactions, and access control mechanisms. For creating tokens on Hyperledger Fabric, one approach is through chaincode (smart contract), which can be written in Go or JavaScript. #### Defining Tokens as Assets Tokens are essentially digital representations of value stored on a ledger. In Hyperledger Fabric, these can be defined using asset definitions inside smart contracts. Each token would have attributes such as owner identity, quantity, type, etc., all encapsulated within an object structure[^1]. ```go type Token struct { Owner string `json:"owner"` Amount int `json:"amount"` } ``` This code snippet demonstrates how to define a simple token with two properties: `Owner` representing the entity owning this particular set of tokens; and `Amount`, indicating the number held by said owner. #### Deploying Chaincode for Managing Tokens To deploy a new instance of your custom-built token management system onto Hyperledger Fabric network nodes requires packaging up both business logic implemented via functions alongside any necessary configuration files into what's known as "chaincode". Once packaged appropriately according to official documentation guidelines provided by IBM[^2], deployment becomes straightforward utilizing CLI tools available from the platform itself: ```bash peer chaincode install -n mytokencontract -v 1.0 -p github.com/myorg/token_contract/ peer chaincode instantiate -o orderer.example.com:7050 --tls true \ --cafile /path/to/orderers-tls-cert.pem -P "OR ('Org1MSP.member','Org2MSP.member')" ``` These commands first compile then initialize the specified version (`1.0`) of our hypothetical 'mytokencontract' under channel named 'mychannel'. The `-P` flag specifies endorsement policy ensuring only authorized parties may invoke operations against deployed instances later down line during runtime execution phase when interacting directly over RESTful APIs exposed externally outside peer processes themselves. #### Interacting With Deployed Contracts Through API Calls Once successfully instantiated across participating organizations’ peers forming part of consortium arrangement agreed upon beforehand between stakeholders involved at project initiation stage prior starting development work proper – developers now possess capability making calls towards endpoints made accessible thanks largely due efforts put forth throughout previous steps outlined above already covered earlier sections hereinbefore mentioned paragraphs preceding current section being read presently right here & now! For example, issuing new tokens might look something like below depending exact specifications laid out internally within organization responsible maintaining respective repositories hosting source codes related projects built atop hyperledger fabric framework specifically designed cater needs specific use cases encountered various industries ranging finance healthcare supply chain logistics among others: ```javascript async function issueToken(stub, args) { const { issuerId, recipientId, amount } = JSON.parse(args); let token = await stub.getState(issuerId); if (!token || !JSON.parse(token).amount >= parseInt(amount)) throw Error('Insufficient balance'); // Update Issuer Balance token = JSON.parse(token); token.amount -= parseInt(amount); await stub.putState(issuerId, Buffer.from(JSON.stringify(token))); // Create Recipient Entry If Not Exists And Add New Tokens To It. try { var recipientBalance = await stub.getState(recipientId); recipientBalance = JSON.parse(recipientBalance); } catch(e){ console.log(`Recipient ${recipientId} does not exist yet`); recipientBalance = {"amount": 0}; } recipientBalance.amount += parseInt(amount); await stub.putState(recipientId, Buffer.from(JSON.stringify(recipientBalance))); return {'status': 'success'}; } ``` The presented JavaScript method illustrates transferring ownership while adjusting balances accordingly based off input parameters passed along invocation request sent client side application layer interfacing backend services running server machines connected distributed networks powered consensus algorithms guarantee transaction integrity security features inherent design choices taken architects engineers crafting solutions leveraging decentralized ledgers technologies today modern era computing science research advancements pushing boundaries knowledge ever forward continuously evolving field study computer sciences information systems engineering software development practices methodologies frameworks libraries toolkits SDKs APIs webhooks microservices architectures cloud native applications container orchestration kubernetes helm charts gitops ci/cd pipelines devops culture agile scrum kanban lean startup principles product management strategies go-to-market plans marketing campaigns sales funnels customer support ticketing systems helpdesk workflows automation bots chatbots voice assistants virtual reality augmented reality mixed reality spatial computing human-computer interaction user experience design visual design graphic design motion graphics video production audio editing sound design music composition game engines physics simulations machine learning artificial intelligence neural networks deep learning natural language processing speech recognition image recognition pattern matching anomaly detection predictive analytics prescriptive analytics big data small data edge computing fog computing quantum computing classical computing theoretical foundations mathematics statistics probability theory combinatorics graph theory cryptography hash functions encryption decryption public keys private keys certificates authorities trust models reputation systems incentive structures economic theories behavioral economics psychology sociology anthropology linguistics philosophy ethics law regulations compliance standards certifications quality assurance testing validation verification formal methods model checking property-based testing
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值