Papers Review

[논문 리뷰] DRÆM – A discriminatively trained reconstruction embedding for surface anomaly detection

ssun-g 2022. 12. 12. 20:00

Introduction

표면 이상 탐지(surface anomaly detection)는 정상적인 형태에서 벗어난 이미지 영역의 위치를 찾는 것.
  • 일반적인 이상 탐지정상적인 학습 이미지 세트와 크게 다른 이미지를 찾는 것.
  • 표면 이상 탐지이미지 픽셀의 작은 부분만을 차지하며 일반적으로 학습 이미지 세트 분포와 유사


DRÆM (Discriminative joint Reconstruction Anomaly Embedding Method)

  • DRÆM은 다음 두 가지 sub-network로 구성 된다.
    • Reconstructive sub-network
      • 정상 이미지만 학습
    • Discriminative sub-network
      • 원본 이미지와 재구성된 이미지의 결합 모양에 대한 판별을 학습→ 생성 방식(auto-encoder, GAN 등)과 달리 합성된 이상 형태가 test time에 이상과 일치할 필요가 없음.
        (Figure 1의 실제 결함(GT)과 test에 사용되는 합성된 이상 형태(Synthetic Anomalies)가 일치하지 않음)
  • 모델 구조


1. Reconstructive sub-network

  • 해당 네트워크는 시뮬레이터에서 얻은 인위적으로 손상된 이미지 \(I_a\)에서 원래 이미지인 \(I\)를 재구성 하도록 학습시킨다.
    (3. Simulated anomaly generation 참조)
  • \(l_2\) Loss는 재구성 기반 anomaly detection에서 많이 사용되지만 이웃 픽셀 간의 독립성을 가정하므로 패치 기반의 SSIM Loss를 추가로 사용한다.

SSIM Loss

  • \(W\) : image \(I\)의 width
  • \(H\) : image \(I\)의 height
  • \(N_p\) : \(I\)의 픽셀 수
  • \(I_r\) : 네트워크에 의해 재구성된 이미지
  • \(SSIM(I, I_r)_{(i, j)}\) : 이미지 좌표 \((i, j)\)를 중심으로 하는 \(I, I_r\) 패치의 SSIM value.

Reconstructive sub-network의 최종 Loss

  • 재구성 했을 때, 원본과의 차이를 감지해 anomaly localization을 수행하는 downstream discriminative network로부터 추가적인 training signal을 획득한다.(2. Discriminative sub-network 참조)
  • \(\lambda\) : Loss balancing hyper-parameter

2. Discriminative sub-network

  • U-Net과 같은 아키텍처 사용
  • Discriminative sub-network의 입력인 \(I_c\)는 다음으로 정의된다.
    • Reconstructive sub-network의 출력 \(I_r\)과 input image \(I\)의 채널별 concatenation.
  • Reconstruction-base anomaly detection에서는 SSIM과 같은 방법으로 원본 이미지와 재구성된 이미지를 비교하지만 surface anomaly detection에서 특정한 similarity를 측정하는 것은 어렵다.
  • 반면, Discriminative sub-network는 적절한 거리(distance) 측정을 자동으로 학습한다. (distance == similarity)

 

DRÆM의 전체 Loss는 다음과 같다.

DRÆM Loss

  • \(M_a\) : Ground Truth
  • \(M\) : anomaly segmentation masks의 출력

3. Simulated anomaly generation

  • \(P\) : 노이즈 이미지는 Perlin noise generator에 의해 생성되어 다양한 anomaly shapes를 생성
  • \(M_a\): 무작위로 균일(uniformly)하게 샘플링된 threshold에 의해 anomaly map인 \(M_a\)로 이진화
  • Anomaly aource image \(A\)는 input image와 관련이 없는 anomaly source image dataset에서 샘플링한다.
  • RandAugment에서 영감을 받은 Random augmentation sampling을 수행한다.
    • 다음 augmentation중 3개를 랜덤으로 선택
      • posterize
      • sharpness
      • solarize
      • equalize
      • brightness change
      • color change
      • auto-contrast
  • augmentation이 적용된 이미지 \(A\)는 anomaly map \(M_a\)로 마스킹 되고, \(I\)와 혼합되어 just-out-of-distribution\(I_a\) 생성
    decision boundary를 결정하는데 도움이 된다.
  • 다음과 같이 anomaly source image에서 무작위 augmentation을 적용하여 데이터 증강이 가능하다.

좌: 원본 이상 이미지 / 중: 다양한 augmentation 적용 / 우: blending


4. Surface anomaly localization and detection

  • Discriminative sub-network의 출력은 pixel 단위의 anomaly detection mask \(M_o\)
    • 이를 통해 anomaly score estimation 가능. 즉, 이미지에 이상이 존재하는 간단히 해석 가능
    • mean filter convolution layer에 의해 평활화(smoothed) 되어 local anomaly response 정보를 집계
  • 최종 image-level의 anomaly score \(\eta\)smoothed anomaly score map의 최대값

\(f_{s_f \times s_f}\) : \(s_f \times s_f\) 크기의 평균 필터(mean filter)

* : convolution 연산


Experiments

Comparison with unsupervised methods

AUROC

  • [1] : GANomaly
  • [26]: Adversarial Dual Auto-Encoders (ADAE)
  • [4]: Student-Teacher Anomaly Detection
  • [31]: Reconstruction By Inpainting For Visual Anomaly Detection (RIAD)
  • [20]: Modeling The Distribution Of Normal Data In Pre-Trained Deep Features For Anomaly Detection
  • [11]: Patch Distribution Modeling (PaDiM)

AUROC / AP

  • 모델 별 anomaly map 생성 비교

  • 1 행: 원본 이미지
  • 2 행: Uninformed Students에 의해 생성된 anomaly map 시각화
  • 3 행: PaDiM에 의해 생성된 anomaly map 시각화
  • 4 행: DRÆM에 의해 생성된 anomaly map 시각화
  • 5 행: DRÆM의 실제 anomaly map output

학습 환경

  • epochs : 700
  • datasets: MVTec AD
  • learning rate: 시작값은 \(10^{-4}\)이고, 400, 600 epoch 이후 0.1씩 곱함
  • augmentation: (-45, 45) 범위 회전
  • anomaly source dataThe Describable Textures Dataset 사용
  • 학습 데이터 예시

학습 데이터 예시


Comparison with supervised methods

  • supervised learning은 annotation이 필요하므로 MVTec AD dataset은 이용 불가
  • DAGM dataset으로 성능 비교

augmentation에 따른 성능 비교

 

다른 모델과의 성능 비교

  • DRÆM은 label을 사용하지 않기 때문에 다른 모델에 비해 정확한 Localization이 가능하다.
    (다음 사진의 Ground Truth를 보면 타원형으로 거칠게(coarsely) labeled 되어 있다)