Introduction

DifferNet 是首个将 归一化流(Normalizing Flows, NF) 引入工业图像异常检测(AD)的研究成果。

Untitled

  1. NF通过一系列可逆的变换(Bijective mapping),将复杂的图像特征分布映射到一个**多元独立高斯分布(标准正态)**上
    1. 将所有正常样本的特征转换到高斯分布中心;
    2. 异常样本在经过同样的变换后,会明显偏离训练时形成的高斯分布。
    3. 归一化流能够比简单的单峰高斯模型更好地捕捉Multimodal分布。
    4. 纯粹的归一化流直接处理高分辨率图像时,会面临严重的“维度灾难”。DifferNet 的核心解法是:先用预训练的 CNN 提取图像的低维高级特征,然后再用归一化流网络去精确估计这些正常特征的概率密度(Likelihood)。
  2. Why from image features not from images?
    1. 直接处理全分辨率图像需要极大的计算开销
    2. With image data, the problem arises that the network mainly focuses on local pixel correlation without taking semantics into account.
  3. Image level judgement but can location via loss back propagation.
    1. bijective mapping ⇒ improved location accuracy.
    2. but the NF is between image feature y and latent z, the feature encoder f_ex() is not bijective, y=f_ex(x).

Method

Untitled

  1. $y=f_{ex}(x)$
    1. y∼未知分布
    2. f_ex(): pre-trained feature extractor, such as VGG
  2. $z=f_{NF}(y)$,
    1. Z是一个隐空间(Latent Space),这个空间中的数据z∈Z服从Standard Multivariate Gaussian distribution(即 z∼N(0,I) or pZ(z)=N(0,I))。
    2. f_NF: the module of Real-NVP [8]
  3. loss: ****
    1. 根据概率论中的变量代换定理(Change of Variables)

      $$ p_Y(y) = p_Z(z) \left| \det \frac{\partial z}{\partial y} \right| $$

    2. max正常样本特征的似然度likelihood p_Y(y), 即正样本概率大

    3. =》 最小化负对数似然 (Negative Log-Likelihood, NLL), 即min -log(p_Y(y))

    4. 虽然 p_Y(y) 在数学形式上是一个概率密度函数,但在统计推断和模型训练的语境下,它被称为 likelihood(似然),原因如下:

      概念 符号 解释角度 固定的是什么?
      Probability p(y∣θ) 给定参数 θ,数据 y 出现的概率 参数 θ
      Likelihood L(θ∣y)=p(y∣θ) 给定数据y,参数 θ的"合理性" 数据 y
  4. Inference
    1. y和z在不同的空间,但是p_Y(y)和p_Z(z)成正比

    2. f_NF没见过的特征y会被映射到正态分布的边缘甚至更远的地方,导致算出的p_Z(z)极小。

    3. Anomaly score of image x

      Untitled

      1. x⇒z,z带入standard gaussian⇒p(z)
      2. the average score over a set of transformation T ⇒ more robust.
      3. 用一个固定阈值就可以筛选,从而实现“图像分类”。
      4. T is common data enhancement, such as rotations and manipulations of brightness and contrast
  5. localization
    1. identifies the defective region by back propagating the negative log-likelihood loss, L, back to the input image pixel x ⇒ gradient map / anomaly map gx.

      Untitled

    2. x( -log(p_Y(y)) )

    3. each input channel x_c;

    4. 高斯平滑:G高斯kernel,∗ as 2D convolution.

    5. 原图中哪个像素稍微改变一点点,就能大幅影响最终的异常得分?这就意味着这个像素就是缺陷所在!梯度绝对值越大的区域,就是缺陷被定位的区域.

Experiments

  1. The feature distributions of single or multiple categories
    1. table 2,在当时是一个很大的提高:83.9=》94.9 detection AUROC on MVTec;
    2. Multimodality: using all 15 categories of MVTec as training data: detection AUROC 90.2%
  2. 16 training images / 16 shots: 87.3
    1. table 1, fig 7 值得看一下
    2. 16 shots denotes a model trained on only 16 images
  3. no quantity results for localization, just fig 8.
  4. 所以还是不少误检
    1. Normalized histogram of DifferNet’s anomaly scores for the test images of MTD.

Untitled