How and Why: Taming Flow Matching for Unsupervised Anomaly Detection and Localization

📄 arXiv: 2508.05461v1 📥 PDF

作者: Liangwei Li, Lin Liu, Juanxiu Liu, Jing Zhang, Ruqian Hao, Xiaohui Du

分类: cs.CV

发布日期: 2025-08-07


💡 一句话要点

提出基于Flow Matching的无监督异常检测与定位方法,克服模型表达力限制。

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture)

关键词: Flow Matching 无监督学习 异常检测 异常定位 向量场回归

📋 核心要点

  1. 传统基于流的异常检测方法存在模型表达力不足的挑战,难以有效区分正常和异常样本。
  2. 论文提出基于Flow Matching的异常检测框架,通过构建非概率演化路径,增强对样本轨迹的动态控制。
  3. 实验表明,该方法在MVTec数据集上取得了单尺度下的最优性能,验证了其有效性。

📝 摘要(中文)

本文提出了一种新的基于Flow Matching (FM) 的无监督异常检测与定位范式,从根本上解决了传统基于流的方法的模型表达力限制。为此,我们将时间反转Flow Matching (rFM) 形式化为沿预定义的概率路径将未知数据分布转换为标准高斯分布的向量场回归。我们提出了两个重塑我们对FM理解的核心观察。首先,我们严格证明了具有线性插值概率路径的FM本质上是不可逆的。其次,我们的分析表明,在高维空间中使用反向高斯概率路径会导致平凡的向量场。这个问题是由于与流形相关的约束引起的。基于第二个观察,我们提出了最坏传输 (WT) 位移插值来重建非概率演化路径。所提出的 WT-Flow 增强了对样本轨迹的动态控制,为无异常样本构建“退化势阱”,同时允许异常样本逃逸。这种新颖的无监督范式为异常样本提供了一个理论上可靠的分离机制。值得注意的是,FM 提供了一个计算上易于处理的框架,可以扩展到复杂数据。我们展示了 FM 在无监督异常检测任务中的首次成功应用,在 MVTec 数据集上以单尺度实现了最先进的性能。训练的可复现代码将在提交最终版本后发布。

🔬 方法详解

问题定义:论文旨在解决无监督异常检测与定位问题。现有基于流的方法在模型表达能力上存在局限性,难以准确捕捉复杂数据分布中的异常模式。此外,在高维空间中,直接应用Flow Matching可能导致向量场退化,影响检测效果。

核心思路:论文的核心思路是利用Flow Matching将数据分布转换到标准高斯分布,并通过控制样本轨迹的演化过程来实现异常样本的分离。为了避免向量场退化,论文提出了基于Worst Transport (WT) 的位移插值方法,构建非概率演化路径。

技术框架:整体框架包括以下几个主要步骤:1) 使用WT位移插值构建非概率演化路径;2) 利用Flow Matching学习时间反转的向量场,将数据分布映射到高斯分布;3) 通过分析样本在演化过程中的轨迹,判断其是否为异常样本。框架的关键在于WT位移插值和Flow Matching的结合,前者保证了演化路径的有效性,后者提供了计算高效的映射方法。

关键创新:论文的关键创新在于:1) 提出了时间反转Flow Matching (rFM) 的概念,并将其应用于异常检测;2) 提出了Worst Transport (WT) 位移插值方法,解决了高维空间中向量场退化的问题;3) 将Flow Matching成功应用于无监督异常检测任务,并取得了state-of-the-art的性能。

关键设计:论文的关键设计包括:1) 使用线性插值概率路径的FM,并证明其本质上是不可逆的;2) 分析了高维空间中使用反向高斯概率路径导致平凡向量场的原因;3) 提出了基于WT位移插值的非概率演化路径,并设计了相应的损失函数来训练模型。具体的网络结构和参数设置在论文中未详细说明,需要在代码发布后进一步分析。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

该方法在MVTec数据集上取得了单尺度下的最优性能,超过了现有的基于流的方法。具体的性能数据和对比基线将在论文的最终版本中公布。实验结果表明,该方法能够有效区分正常和异常样本,并具有良好的定位精度。

🎯 应用场景

该研究成果可应用于工业质检、医疗影像分析、网络安全等领域。例如,在工业质检中,可以利用该方法自动检测产品表面的缺陷;在医疗影像分析中,可以辅助医生诊断疾病;在网络安全领域,可以识别恶意流量和攻击行为。该方法具有重要的实际应用价值和广阔的应用前景。

📄 摘要(原文)

We propose a new paradigm for unsupervised anomaly detection and localization using Flow Matching (FM), which fundamentally addresses the model expressivity limitations of conventional flow-based methods. To this end, we formalize the concept of time-reversed Flow Matching (rFM) as a vector field regression along a predefined probability path to transform unknown data distributions into standard Gaussian. We bring two core observations that reshape our understanding of FM. First, we rigorously prove that FM with linear interpolation probability paths is inherently non-invertible. Second, our analysis reveals that employing reversed Gaussian probability paths in high-dimensional spaces can lead to trivial vector fields. This issue arises due to the manifold-related constraints. Building on the second observation, we propose Worst Transport (WT) displacement interpolation to reconstruct a non-probabilistic evolution path. The proposed WT-Flow enhances dynamical control over sample trajectories, constructing ''degenerate potential wells'' for anomaly-free samples while allowing anomalous samples to escape. This novel unsupervised paradigm offers a theoretically grounded separation mechanism for anomalous samples. Notably, FM provides a computationally tractable framework that scales to complex data. We present the first successful application of FM for the unsupervised anomaly detection task, achieving state-of-the-art performance at a single scale on the MVTec dataset. The reproducible code for training will be released upon camera-ready submission.