SlideShare a Scribd company logo
1 of 27
Anomaly Detection with GANs
https://arxiv.org/abs/1703.05921
Postech 이도엽씨가 구현한 Tensorflow 코드
https://github.com/LeeDoYup/AnoGAN
처음 접하는 분들을 위하여 우선
Generative Adversarial Network부터
간단히 알아보자
판별모델(discriminative model)이 아닌 생성모델(generative model) !
판별모델 생성모델
• 많아 봐왔던 일반적인 기계학습은 판별모델(class별 확률계산)
- class를 나누기 위해 선(decision boundary)을 찾는다 !
• 생성모델은 판별하는 것이 아니라 class별 범위(distribution)를 찾는다 !
 GAN, VAE
Generative Adversarial Network 이란 ?
왜 이런 어려운 모델까지 ?
Curse of Dimensionality
• In many applications, we simply vectorize an image or image patch
• 256 x 256 image converts to a 65,536-dimensional vector.
• Images, therefore, are typically very high-dimensional data
• Affects the convergence of any learning algorithm.
• In some applications, we know that there are only a few variables, for e.g.,
face pose and illumination.
• Data lie on some low-dimensional subspace/manifold in the high-dimensional
space.
 주어진 data set의 축약된 모델(Manifold)을 찾아보자 !
특징이 서로 얽혀 있어 해석이 불가능한 Physical space에서
해석이 용이하도록 서로 독립적인 Eigen space로 변환하는 것 처럼
영향이 매우 작으므로
무시
Manifold Assumption
• Data lie approximately on a manifold of much lower
dimension than the input space
• Mapping between two space is unique & reversible
Manifold Assumption
Manifold Assumption
- The curse of dimensionality can be mitigated under the manifold assumption.
- Linear dimensionality reduction techniques like PCA have been widely used in
the vision community.
- Recent trend is towards non-linear techniques that recover the intrinsic
parameterization (pose, emotion, illumination, etc  mode).
GAN이란 ?
• GAN: Generative Adversarial Networks [Goodfellow+,2014]
– Generator (G)와 Discriminator (D)를 서로 경쟁시켜서
생성 정확도의 향상을 도모하는 모델
GAN이란?
GAN: Generative Adversarial Networks [Goodfellow+,2014]
• Generator (G)와 Discriminator (D)를 서로 경쟁시켜서
생성 정확도의 향상을 도모하는 모델
• G : 생성용 벡터 z로부터 데이터를 생성
• D : 대상 데이터가 진짜(데이터 세트)
인가 가짜(G에 의해 생성)를 식별
데이터셋의 데이터를
「진짜」로 식별
생성된 데이터를「위조」로 식별
D(Image) : Discriminator에 의해 계산된 “image가 real일 확률”
Discriminator가 「진짜」에 대해서는 “1”에 가깝도록
Generator가 생성한 「위조」에 대해서는 “0”에 가깝도록
 D(x)  1, D(G(z))  0 이 되도록
log(1-G(x))
G(x)
log(x)
x
2 개의 모델을 만들어 경쟁시킴으로써 데이터의 분포를 학습시키는
비지도학습 프레임 워크
: Generator에 의해 예측된 데이터 분포
Diagram of Standard GAN
이제 본격적으로
Unsupervised Anomaly Detection with
GANs to Guide Marker Discovery
Anomaly detection : 정상치에서 벗어난 관측치들을 detect 
One-class classification 혹은 one-class description
Anomaly detection 문제점 : 보통 현실에서는 비정상 관측치가 거의
없는 경우가 많기 때문
통상 제조 공정에서 관리되는 품질 수준이 ppm단위
이런 경우에는 정상 관측치를 모델링함으로서 그 모델에서 벗어나는
정도를 기반으로 fault detection
이 연구에서는 아래 그림처럼 정상 data만으로 학습시킨 GAN
모델를 이용하여 Query data에 대하여 정상여부는 물론
비정상 시 비정상 영역을 찾아내고자 함.
1. 정상 data를 이용하여 Generator & Discriminator의 훈련
- Deep convolutional generative adversarial network을 이용하여
latent space(z)로 부터 Generator를 이용하여 생성된 image와
Real image를 구별하도록 Discriminator를 훈련
 정상 data의 latent space(z) 분포를 학습
2. 비정상 data여부와 비정상 영역 파악
- 훈련된 Generator & Discriminator의 parameter를 고정한 채
Query image에 대한 latent space(z)로의 mapping 작업을 수행
훈련된 정상 data의 경우, 기학습된 정상 data의 latent space(z) 로
mapping이 되지만, 비정상 data의 경우 벗어남
 cost function의 오차가 발생
Anomaly Detection은 다음과 같이 2단계로 이루어짐
1. GAN을 이용하여 정상 data 모델링하기
: 정상 data의 generative model(distribution)을 GAN을 이용하여 학습
정상 𝑑𝑎𝑡𝑎 𝐼 𝑚, with m = 1,2,.....,M, where 𝐼 𝑚 ∈ 𝑅 𝑎𝑥𝑏
임의의 위치에서 랜덤하게 cxc크기의 K 2-D image
patches를 추출 x = 𝑥 𝑘,𝑚 ∈ ℵ with k = 1,2,……,K.
D and G are simultaneously optimized through the following two-
player minimax game with value function V (G,D)
The discriminator is trained to maximize the probability of assigning
real training examples the “real” and samples from 𝑝 𝑔the “fake” label
2. Query data의 latent space Mapping
Query image x가 주어질 경우, 이와 가장 유사한 가상 image인 G(z) 에
해당하는 latent space상의 점 z을 찾는다.
x 와 G(z)의 유사여부는 query image가 generator의 훈련시 사용된 정상
data의 분포 𝑝 𝑔를 어느 정도 따르느냐에 의해 결정
z을 찾기 위하여 , latent space distribution Z에서 랜덤하게 샘플된 z1 을
기훈련된 generator에 입력하여 얻은 출력 G(z1)와 x의 차(loss ft’n)를 최
소화하도록 backpropagation을 통하여 latent space의 점z2로 update
z
정상 image의 Latent space(z)가 1차원이라고 가정하고
Z은 다음과 같은 분포로 가정하면
𝜇 𝑧
z𝜇 𝑧
Query image에 대한 latent space(z) mapping은
i) 임의의 값 𝑧1에서 시작하여 loss ft’n을 최소화하도록 update
ii) 주어진 Γ번째 iteration 후 𝑧Γ이 allowable range안에 들어왔는지
여부에 때라 정상, 비정상을 구분
𝑧1 𝑧2 𝑧Γ
Allowable range
• Overall loss or Anomaly score:
• Anomaly score consists of two parts:
• Residual Loss - visual similarity
• Discrimination Loss - enforces the generated image to lie on the manifold
Query Image의 Mapping에 대한 Loss function 정의
Improved discrimination loss based on feature matching
• f(.) – output of intermediate layer of the discriminator
• It is some statistics of an input image
This approach utilizes the trained discriminator not as classifier
but as a feature extractor
3. Anomaly Detection
Anomaly score : query image x가 정상 image에 얼마나 부합하는지 여부
R(x) : Γ번의 backpropagation후 Residual loss
D(x) : Γ번의 backpropagation후 Discrimination Loss
비정상 image : A(x) is large
정상 image : A(x) is small
𝑥 𝑅 = 𝑥 − 𝐺 𝑧Γ
Residual error : image내의 비정상 영역을 나타냄
4. Experiments
실험대상은 망막층을 3차원적으로 관측하는 빛간섭단층촬영(OCT) 영상
• Data, Data Selection and Preprocessing
i) Training sets :
- 2D image patches extracted from 270 clinical OCT volumes of healthy subjects
- The gray values were normalized to range from -1 to 1.
- Extracted in total 1,000,000 2D training patches with an image resolution of
64x64 pixels at randomly sampled positions.
ii) Testing sets :
- patches were extracted from 10 additional healthy cases and 10
pathological cases, which contained retinal fluid
- Test set in total consisted of 8,192 image patches and comprised
normal and pathological samples
iii) Model description
- Adopt DCGAN architecture that resulted in stable GAN training on
images of sizes 64x64 pixels.
- Utilized intermediate representations with 512-256-128-64 channels
(instead of 1024-512-256-128)
- Discrimination loss : Feature representations of the last convolution
layer of the discriminator was used
- Training was performed for 20 epochs utilizing Adam optimizer.
- Ran 500 backpropagation steps for the mapping of new images to the
latent space.
- Used λ= 0.1 in loss function
i) Generative capability of the DCGAN
5. Experiments
Given image
Generated image
Residual overlay
Pixel-level annotations
of retinal fluid
Normal image Anomalous image
ii) Detection performance
ROC curves
Distribution of the residual score(c)
and of the discrimination score(d)
Latent space에서 정상 data(trained data 및 test data 중 정상)간의 분포는
유사하나 Test data 중 비정상과는 확실한 차이를 나타냄

More Related Content

What's hot

Computer Vision for Beginners
Computer Vision for BeginnersComputer Vision for Beginners
Computer Vision for Beginners
Sanghamitra Deb
 

What's hot (20)

Optimization in deep learning
Optimization in deep learningOptimization in deep learning
Optimization in deep learning
 
Introduction to Generative Adversarial Networks
Introduction to Generative Adversarial NetworksIntroduction to Generative Adversarial Networks
Introduction to Generative Adversarial Networks
 
Generative adversarial text to image synthesis
Generative adversarial text to image synthesisGenerative adversarial text to image synthesis
Generative adversarial text to image synthesis
 
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
Variational Autoencoders VAE - Santiago Pascual - UPC Barcelona 2018
 
Lecture 29 Convolutional Neural Networks - Computer Vision Spring2015
Lecture 29 Convolutional Neural Networks -  Computer Vision Spring2015Lecture 29 Convolutional Neural Networks -  Computer Vision Spring2015
Lecture 29 Convolutional Neural Networks - Computer Vision Spring2015
 
Emerging Properties in Self-Supervised Vision Transformers
Emerging Properties in Self-Supervised Vision TransformersEmerging Properties in Self-Supervised Vision Transformers
Emerging Properties in Self-Supervised Vision Transformers
 
GAN - Theory and Applications
GAN - Theory and ApplicationsGAN - Theory and Applications
GAN - Theory and Applications
 
Introduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-LearnIntroduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-Learn
 
GANs Presentation.pptx
GANs Presentation.pptxGANs Presentation.pptx
GANs Presentation.pptx
 
Introduction to Generative Adversarial Networks (GANs)
Introduction to Generative Adversarial Networks (GANs)Introduction to Generative Adversarial Networks (GANs)
Introduction to Generative Adversarial Networks (GANs)
 
Generative adversarial networks
Generative adversarial networksGenerative adversarial networks
Generative adversarial networks
 
Batch normalization presentation
Batch normalization presentationBatch normalization presentation
Batch normalization presentation
 
Unsupervised visual representation learning overview: Toward Self-Supervision
Unsupervised visual representation learning overview: Toward Self-SupervisionUnsupervised visual representation learning overview: Toward Self-Supervision
Unsupervised visual representation learning overview: Toward Self-Supervision
 
Computer Vision for Beginners
Computer Vision for BeginnersComputer Vision for Beginners
Computer Vision for Beginners
 
Dcgan
DcganDcgan
Dcgan
 
Anomaly/Novelty detection with scikit-learn
Anomaly/Novelty detection with scikit-learnAnomaly/Novelty detection with scikit-learn
Anomaly/Novelty detection with scikit-learn
 
Feature Engineering - Getting most out of data for predictive models
Feature Engineering - Getting most out of data for predictive modelsFeature Engineering - Getting most out of data for predictive models
Feature Engineering - Getting most out of data for predictive models
 
Introduction to TensorFlow 2.0
Introduction to TensorFlow 2.0Introduction to TensorFlow 2.0
Introduction to TensorFlow 2.0
 
Object classification using CNN & VGG16 Model (Keras and Tensorflow)
Object classification using CNN & VGG16 Model (Keras and Tensorflow) Object classification using CNN & VGG16 Model (Keras and Tensorflow)
Object classification using CNN & VGG16 Model (Keras and Tensorflow)
 
Faster R-CNN - PR012
Faster R-CNN - PR012Faster R-CNN - PR012
Faster R-CNN - PR012
 

Similar to Anomaly Detection with GANs

Unsupervised anomaly detection with generative model
Unsupervised anomaly detection with generative modelUnsupervised anomaly detection with generative model
Unsupervised anomaly detection with generative model
TaeKang Woo
 
Detecting fake jpeg images
Detecting fake jpeg imagesDetecting fake jpeg images
Detecting fake jpeg images
NAVER Engineering
 

Similar to Anomaly Detection with GANs (20)

Unsupervised anomaly detection with generative model
Unsupervised anomaly detection with generative modelUnsupervised anomaly detection with generative model
Unsupervised anomaly detection with generative model
 
Detecting fake jpeg images
Detecting fake jpeg imagesDetecting fake jpeg images
Detecting fake jpeg images
 
Anomaly Detection based on Diffusion
Anomaly Detection based on DiffusionAnomaly Detection based on Diffusion
Anomaly Detection based on Diffusion
 
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
 
Crash Course on Graphical models
Crash Course on Graphical modelsCrash Course on Graphical models
Crash Course on Graphical models
 
Anomaly detection practive_using_deep_learning
Anomaly detection practive_using_deep_learningAnomaly detection practive_using_deep_learning
Anomaly detection practive_using_deep_learning
 
십분딥러닝_7_GANs
십분딥러닝_7_GANs십분딥러닝_7_GANs
십분딥러닝_7_GANs
 
Flow based generative models
Flow based generative modelsFlow based generative models
Flow based generative models
 
Lecture 4: Neural Networks I
Lecture 4: Neural Networks ILecture 4: Neural Networks I
Lecture 4: Neural Networks I
 
알기쉬운 Variational autoencoder
알기쉬운 Variational autoencoder알기쉬운 Variational autoencoder
알기쉬운 Variational autoencoder
 
인공신경망
인공신경망인공신경망
인공신경망
 
투명화 처리로 살펴 본 한층 고급화된 모바일 UX
투명화 처리로 살펴 본 한층 고급화된 모바일 UX투명화 처리로 살펴 본 한층 고급화된 모바일 UX
투명화 처리로 살펴 본 한층 고급화된 모바일 UX
 
Naive ML Overview
Naive ML OverviewNaive ML Overview
Naive ML Overview
 
GAN - Generative Adversarial Nets
GAN - Generative Adversarial NetsGAN - Generative Adversarial Nets
GAN - Generative Adversarial Nets
 
Semantic Image Synthesis with Spatially-Adaptive Normalization(GAUGAN, SPADE)
Semantic Image Synthesis with Spatially-Adaptive Normalization(GAUGAN, SPADE)Semantic Image Synthesis with Spatially-Adaptive Normalization(GAUGAN, SPADE)
Semantic Image Synthesis with Spatially-Adaptive Normalization(GAUGAN, SPADE)
 
"Dataset and metrics for predicting local visible differences" Paper Review
"Dataset and metrics for predicting local visible differences" Paper Review"Dataset and metrics for predicting local visible differences" Paper Review
"Dataset and metrics for predicting local visible differences" Paper Review
 
[Tf2017] day4 jwkang_pub
[Tf2017] day4 jwkang_pub[Tf2017] day4 jwkang_pub
[Tf2017] day4 jwkang_pub
 
캐빈머피 머신러닝 Kevin Murphy Machine Learning Statistic
캐빈머피 머신러닝 Kevin Murphy Machine Learning Statistic캐빈머피 머신러닝 Kevin Murphy Machine Learning Statistic
캐빈머피 머신러닝 Kevin Murphy Machine Learning Statistic
 
Graph attention network - deep learning paper review
Graph attention network -  deep learning paper reviewGraph attention network -  deep learning paper review
Graph attention network - deep learning paper review
 
[NDC2016] 신경망은컨텐츠자동생성의꿈을꾸는가
[NDC2016] 신경망은컨텐츠자동생성의꿈을꾸는가[NDC2016] 신경망은컨텐츠자동생성의꿈을꾸는가
[NDC2016] 신경망은컨텐츠자동생성의꿈을꾸는가
 

More from 홍배 김

More from 홍배 김 (20)

Automatic Gain Tuning based on Gaussian Process Global Optimization (= Bayesi...
Automatic Gain Tuning based on Gaussian Process Global Optimization (= Bayesi...Automatic Gain Tuning based on Gaussian Process Global Optimization (= Bayesi...
Automatic Gain Tuning based on Gaussian Process Global Optimization (= Bayesi...
 
Gaussian processing
Gaussian processingGaussian processing
Gaussian processing
 
Lecture Summary : Camera Projection
Lecture Summary : Camera Projection Lecture Summary : Camera Projection
Lecture Summary : Camera Projection
 
Learning agile and dynamic motor skills for legged robots
Learning agile and dynamic motor skills for legged robotsLearning agile and dynamic motor skills for legged robots
Learning agile and dynamic motor skills for legged robots
 
Robotics of Quadruped Robot
Robotics of Quadruped RobotRobotics of Quadruped Robot
Robotics of Quadruped Robot
 
Basics of Robotics
Basics of RoboticsBasics of Robotics
Basics of Robotics
 
Recurrent Neural Net의 이론과 설명
Recurrent Neural Net의 이론과 설명Recurrent Neural Net의 이론과 설명
Recurrent Neural Net의 이론과 설명
 
Convolutional neural networks 이론과 응용
Convolutional neural networks 이론과 응용Convolutional neural networks 이론과 응용
Convolutional neural networks 이론과 응용
 
Anomaly detection using deep one class classifier
Anomaly detection using deep one class classifierAnomaly detection using deep one class classifier
Anomaly detection using deep one class classifier
 
Optimal real-time landing using DNN
Optimal real-time landing using DNNOptimal real-time landing using DNN
Optimal real-time landing using DNN
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function
 
Machine learning applications in aerospace domain
Machine learning applications in aerospace domainMachine learning applications in aerospace domain
Machine learning applications in aerospace domain
 
Anomaly Detection and Localization Using GAN and One-Class Classifier
Anomaly Detection and Localization  Using GAN and One-Class ClassifierAnomaly Detection and Localization  Using GAN and One-Class Classifier
Anomaly Detection and Localization Using GAN and One-Class Classifier
 
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
 
Brief intro : Invariance and Equivariance
Brief intro : Invariance and EquivarianceBrief intro : Invariance and Equivariance
Brief intro : Invariance and Equivariance
 
Focal loss의 응용(Detection & Classification)
Focal loss의 응용(Detection & Classification)Focal loss의 응용(Detection & Classification)
Focal loss의 응용(Detection & Classification)
 
Convolution 종류 설명
Convolution 종류 설명Convolution 종류 설명
Convolution 종류 설명
 
Learning by association
Learning by associationLearning by association
Learning by association
 
Binarized CNN on FPGA
Binarized CNN on FPGABinarized CNN on FPGA
Binarized CNN on FPGA
 
Visualizing data using t-SNE
Visualizing data using t-SNEVisualizing data using t-SNE
Visualizing data using t-SNE
 

Recently uploaded

Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
Wonjun Hwang
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
Wonjun Hwang
 

Recently uploaded (6)

MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
 

Anomaly Detection with GANs

  • 1. Anomaly Detection with GANs https://arxiv.org/abs/1703.05921 Postech 이도엽씨가 구현한 Tensorflow 코드 https://github.com/LeeDoYup/AnoGAN
  • 2. 처음 접하는 분들을 위하여 우선 Generative Adversarial Network부터 간단히 알아보자
  • 3. 판별모델(discriminative model)이 아닌 생성모델(generative model) ! 판별모델 생성모델 • 많아 봐왔던 일반적인 기계학습은 판별모델(class별 확률계산) - class를 나누기 위해 선(decision boundary)을 찾는다 ! • 생성모델은 판별하는 것이 아니라 class별 범위(distribution)를 찾는다 !  GAN, VAE Generative Adversarial Network 이란 ?
  • 4. 왜 이런 어려운 모델까지 ? Curse of Dimensionality • In many applications, we simply vectorize an image or image patch • 256 x 256 image converts to a 65,536-dimensional vector. • Images, therefore, are typically very high-dimensional data • Affects the convergence of any learning algorithm. • In some applications, we know that there are only a few variables, for e.g., face pose and illumination. • Data lie on some low-dimensional subspace/manifold in the high-dimensional space.  주어진 data set의 축약된 모델(Manifold)을 찾아보자 !
  • 5. 특징이 서로 얽혀 있어 해석이 불가능한 Physical space에서 해석이 용이하도록 서로 독립적인 Eigen space로 변환하는 것 처럼 영향이 매우 작으므로 무시 Manifold Assumption
  • 6. • Data lie approximately on a manifold of much lower dimension than the input space • Mapping between two space is unique & reversible Manifold Assumption
  • 7. Manifold Assumption - The curse of dimensionality can be mitigated under the manifold assumption. - Linear dimensionality reduction techniques like PCA have been widely used in the vision community. - Recent trend is towards non-linear techniques that recover the intrinsic parameterization (pose, emotion, illumination, etc  mode).
  • 8. GAN이란 ? • GAN: Generative Adversarial Networks [Goodfellow+,2014] – Generator (G)와 Discriminator (D)를 서로 경쟁시켜서 생성 정확도의 향상을 도모하는 모델
  • 9. GAN이란? GAN: Generative Adversarial Networks [Goodfellow+,2014] • Generator (G)와 Discriminator (D)를 서로 경쟁시켜서 생성 정확도의 향상을 도모하는 모델 • G : 생성용 벡터 z로부터 데이터를 생성 • D : 대상 데이터가 진짜(데이터 세트) 인가 가짜(G에 의해 생성)를 식별 데이터셋의 데이터를 「진짜」로 식별 생성된 데이터를「위조」로 식별
  • 10. D(Image) : Discriminator에 의해 계산된 “image가 real일 확률” Discriminator가 「진짜」에 대해서는 “1”에 가깝도록 Generator가 생성한 「위조」에 대해서는 “0”에 가깝도록  D(x)  1, D(G(z))  0 이 되도록 log(1-G(x)) G(x) log(x) x
  • 11. 2 개의 모델을 만들어 경쟁시킴으로써 데이터의 분포를 학습시키는 비지도학습 프레임 워크 : Generator에 의해 예측된 데이터 분포
  • 13. 이제 본격적으로 Unsupervised Anomaly Detection with GANs to Guide Marker Discovery
  • 14. Anomaly detection : 정상치에서 벗어난 관측치들을 detect  One-class classification 혹은 one-class description Anomaly detection 문제점 : 보통 현실에서는 비정상 관측치가 거의 없는 경우가 많기 때문 통상 제조 공정에서 관리되는 품질 수준이 ppm단위 이런 경우에는 정상 관측치를 모델링함으로서 그 모델에서 벗어나는 정도를 기반으로 fault detection
  • 15. 이 연구에서는 아래 그림처럼 정상 data만으로 학습시킨 GAN 모델를 이용하여 Query data에 대하여 정상여부는 물론 비정상 시 비정상 영역을 찾아내고자 함.
  • 16. 1. 정상 data를 이용하여 Generator & Discriminator의 훈련 - Deep convolutional generative adversarial network을 이용하여 latent space(z)로 부터 Generator를 이용하여 생성된 image와 Real image를 구별하도록 Discriminator를 훈련  정상 data의 latent space(z) 분포를 학습 2. 비정상 data여부와 비정상 영역 파악 - 훈련된 Generator & Discriminator의 parameter를 고정한 채 Query image에 대한 latent space(z)로의 mapping 작업을 수행 훈련된 정상 data의 경우, 기학습된 정상 data의 latent space(z) 로 mapping이 되지만, 비정상 data의 경우 벗어남  cost function의 오차가 발생 Anomaly Detection은 다음과 같이 2단계로 이루어짐
  • 17. 1. GAN을 이용하여 정상 data 모델링하기 : 정상 data의 generative model(distribution)을 GAN을 이용하여 학습 정상 𝑑𝑎𝑡𝑎 𝐼 𝑚, with m = 1,2,.....,M, where 𝐼 𝑚 ∈ 𝑅 𝑎𝑥𝑏 임의의 위치에서 랜덤하게 cxc크기의 K 2-D image patches를 추출 x = 𝑥 𝑘,𝑚 ∈ ℵ with k = 1,2,……,K. D and G are simultaneously optimized through the following two- player minimax game with value function V (G,D) The discriminator is trained to maximize the probability of assigning real training examples the “real” and samples from 𝑝 𝑔the “fake” label
  • 18. 2. Query data의 latent space Mapping Query image x가 주어질 경우, 이와 가장 유사한 가상 image인 G(z) 에 해당하는 latent space상의 점 z을 찾는다. x 와 G(z)의 유사여부는 query image가 generator의 훈련시 사용된 정상 data의 분포 𝑝 𝑔를 어느 정도 따르느냐에 의해 결정 z을 찾기 위하여 , latent space distribution Z에서 랜덤하게 샘플된 z1 을 기훈련된 generator에 입력하여 얻은 출력 G(z1)와 x의 차(loss ft’n)를 최 소화하도록 backpropagation을 통하여 latent space의 점z2로 update
  • 19. z 정상 image의 Latent space(z)가 1차원이라고 가정하고 Z은 다음과 같은 분포로 가정하면 𝜇 𝑧 z𝜇 𝑧 Query image에 대한 latent space(z) mapping은 i) 임의의 값 𝑧1에서 시작하여 loss ft’n을 최소화하도록 update ii) 주어진 Γ번째 iteration 후 𝑧Γ이 allowable range안에 들어왔는지 여부에 때라 정상, 비정상을 구분 𝑧1 𝑧2 𝑧Γ Allowable range
  • 20. • Overall loss or Anomaly score: • Anomaly score consists of two parts: • Residual Loss - visual similarity • Discrimination Loss - enforces the generated image to lie on the manifold Query Image의 Mapping에 대한 Loss function 정의
  • 21. Improved discrimination loss based on feature matching • f(.) – output of intermediate layer of the discriminator • It is some statistics of an input image This approach utilizes the trained discriminator not as classifier but as a feature extractor
  • 22. 3. Anomaly Detection Anomaly score : query image x가 정상 image에 얼마나 부합하는지 여부 R(x) : Γ번의 backpropagation후 Residual loss D(x) : Γ번의 backpropagation후 Discrimination Loss 비정상 image : A(x) is large 정상 image : A(x) is small 𝑥 𝑅 = 𝑥 − 𝐺 𝑧Γ Residual error : image내의 비정상 영역을 나타냄
  • 23. 4. Experiments 실험대상은 망막층을 3차원적으로 관측하는 빛간섭단층촬영(OCT) 영상 • Data, Data Selection and Preprocessing i) Training sets : - 2D image patches extracted from 270 clinical OCT volumes of healthy subjects - The gray values were normalized to range from -1 to 1. - Extracted in total 1,000,000 2D training patches with an image resolution of 64x64 pixels at randomly sampled positions.
  • 24. ii) Testing sets : - patches were extracted from 10 additional healthy cases and 10 pathological cases, which contained retinal fluid - Test set in total consisted of 8,192 image patches and comprised normal and pathological samples
  • 25. iii) Model description - Adopt DCGAN architecture that resulted in stable GAN training on images of sizes 64x64 pixels. - Utilized intermediate representations with 512-256-128-64 channels (instead of 1024-512-256-128) - Discrimination loss : Feature representations of the last convolution layer of the discriminator was used - Training was performed for 20 epochs utilizing Adam optimizer. - Ran 500 backpropagation steps for the mapping of new images to the latent space. - Used λ= 0.1 in loss function
  • 26. i) Generative capability of the DCGAN 5. Experiments Given image Generated image Residual overlay Pixel-level annotations of retinal fluid Normal image Anomalous image
  • 27. ii) Detection performance ROC curves Distribution of the residual score(c) and of the discrimination score(d) Latent space에서 정상 data(trained data 및 test data 중 정상)간의 분포는 유사하나 Test data 중 비정상과는 확실한 차이를 나타냄