• 검색 결과가 없습니다.

GAN (Generative Adversarial Networks

N/A
N/A
Protected

Academic year: 2021

Share "GAN (Generative Adversarial Networks"

Copied!
20
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

Generative

Adversarial

Network

Wanho Choi

(wanochoi.com)

(2)

“GAN is the

most interesting idea in the last ten years in machine learning.”

(3)

Who Invented

(4)
(5)

GAN

Generative Adversarial Network

Generative: It is a generative model. (generation = making a plausible fake)

Adversarial: G and D compete against each other improving each other.

Network: Both G and D use deep neural networks.

Two models fighting against each other

would be able to co-train through plain old back-propagation.

decision : real or fake fake data real data

D

iscriminator (discriminative model)

G

enerator (generative model)

(6)

Goodfellow’s Metaphor

지폐위조범(Generator)과 경찰(Discriminator)은 서로 적대적인 경쟁 관계이다.

위조지폐범은 최대한 진짜같은 위조지폐를 만들어서 경찰을 속이기 위해 노력한다. (생성)

경찰은 위조 지폐인지 아닌지를 판별하기 위해 노력한다. (분류)

이러한 과정을 조금씩 오랫동안 거치면.. 위조지폐범은 진짜와 구별하기 어려운 위조지폐를 만들어 내는 능력을 가지게 된다. (경찰의 real/fake 구별 확률이 0.5로 수렴한다.) Generator (생성 모델) Discriminator (분류 모델) fake data real data decision real / fake

(7)

Generator

(=생성 네트워크)는 (=랜덤 변수)를 입력으로 받는다.

개념적으로 는 latent features를 나타낸다. (즉, : latent vector) (ex) 색상, 형태, …

하지만 GAN은 학습의 결과로 인해 를 얻게될 뿐, 에 대해 별다른 제어를 하지는 않는다.

만약 latent space 상에서의 의 의미를 알고 싶다면 학습이 끝난 후에 를 점차적으로 변화시키면서 출력 데이터가 어떻게 변하는지를 관찰하면 된다.

G

z

z

z

z

z

z

z

Generator (생성 모델)

̂x

z ∼ P(Z)

̂x = G(z)

: fake data

(8)

Exploring the GAN’s Latent Space

왼쪽을 바라보는 얼굴을 만들어 내는 z 오른쪽을 바라보는 얼굴을 만들어 내는 z interpolation

(9)

Arithmetic Operation

(10)

Modeling Probability Distribution

어떠한 확률 변수가 특정 확률 분포를 따른다.

이 확률 변수의 확률 분포를 알고 있다.

이 확률 변수의 기대값, 분산, 표준편차 등의 통계적 특성을 분석할 수 있다.

주어진 확률분포를 따르도록 데이터를 임의 생성한 데이터는 실측 데이터와 유사한 값을 가진다.

GAN: 학습 데이터의 확률 분포를 모델링할 수 있으면, 그럴듯한 가짜 데이터를 만들어낼 수 있다. https://dreamgonfly.github.io/2018/03/17/gan-explained.html Generator는 단순한 분포를 복잡한 분포로 매핑하는 함수이다.

latent space: z-vector가 존재하는 공간. latent space dimension은 제한이 없지만,

(11)

Modeling Probability Distribution

어떠한 확률 변수가 특정 확률 분포를 따른다.

이 확률 변수의 확률 분포를 알고 있다.

이 확률 변수의 기대값, 분산, 표준편차 등의 통계적 특성을 분석할 수 있다.

주어진 확률분포를 따르도록 데이터를 임의 생성한 데이터는 실측 데이터와 유사한 값을 가진다.

GAN: 학습 데이터의 확률 분포를 모델링할 수 있으면, 그럴듯한 가짜 데이터를 만들어낼 수 있다. noise ~ normal distribution

G

fake data real data

D

real/fake classification gradient comparison https://poloclub.github.io/ganlab/

(12)

https://www.youtube.com/watch?time_continue=10&v=kSLJriaOumA

(13)

GAN Pseudo Code

R = NextBatch() # real data

Z = GenerateNoise() # latent space

F = Generator( Z ) # fake data

D_fake = Discriminator( F ) D_real = Discriminator( R )

D_cost = -SUM( log( D_real ) + log( 1 - D_fake ) ) G_cost = -SUM( log( D_fake ) )

Minimize( D_cost ) Minimize( G_cost )

(14)

Decision Function: y=D(x)

R = NextBatch() # real data

Z = GenerateNoise() # latent space

F = Generator( Z ) # fake data

D_fake = Discriminator( F ) D_real = Discriminator( R )

D_cost = -SUM( log( D_real ) + log( 1 - D_fake ) ) G_cost = -SUM( log( D_fake ) )

Minimize( D_cost ) Minimize( G_cost )

A function quantifying a decision

It returns y close to 0 as x is judged to be fake.

It returns y close to 1 as x is judged to be real. Decision Function fake data 0.0 Decision Function real data 1.0

(15)

Recap: Logarithm

−∞ ≈ log(0 + ϵ) 0 ≈ log(1 − ϵ)

y = log x

(0.0 < x < 1.0)

It gets closer to 0 as it gets closer to 1.

It gets exponentially negative infinity as it gets closer to 0.

(16)

Objective Function (1/2)

R = NextBatch() # real data

Z = GenerateNoise() # latent space

F = Generator( Z ) # fake data

D_fake = Discriminator( F ) D_real = Discriminator( R )

D_cost = -SUM( log( D_real ) + log( 1 - D_fake ) ) G_cost = -SUM( log( D_fake ) )

Minimize( D_cost ) Minimize( G_cost )

From the generator’s point of view

D(F) should have a value close to 1.0.

Therefore, we can define the loss function as follows.

We should maximize.

Thus, we should minimize the minus of it.

log(D(F))

(17)

Objective Function (2/2)

R = NextBatch() # real data

Z = GenerateNoise() # latent space

F = Generator( Z ) # fake data

D_fake = Discriminator( F ) D_real = Discriminator( R )

D_cost = -SUM( log( D_real ) + log( 1 - D_fake ) ) G_cost = -SUM( log( D_fake ) )

Minimize( D_cost ) Minimize( G_cost )

From the discriminator’s point of view

D(R) should have a value close to 1.0.

D(F) should have a value close to 0.0.

Therefore, we can define the loss function as follows.

We should maximize.

Thus, we should minimize the minus of it.

log(D(R)) + log(1 − D(F))

(18)

How To Train GAN

decision : real or fake fake data real data

D

iscriminator (discriminative model)

G

enerator

(generative model) combined network

To train the discriminator network

D( real_data ) ⟶ 1.0

D( fake_data ) ⟶ 0.0

To train the combined network: C( x ) = D( G( x ) )

(19)

Mode Collapsing Problem

(20)

참조

관련 문서

Metz, “Unsupervised representation learning with deep convolutional generative adversarial networks”, ICLR(International Conference on Learning Representations)

즉 구하는 경우의 수는 서로 다른 5개의 접시를 원형으로 배열하 는 원순열의 수와 같다... 확률변수 Y의 확률분포를 표로

워드 임베딩 방법을 이용한 미등록어의 단어 대체 방법은 미등록어를 벡터 값으로 변환하여 벡터 공간상에서 미등록어와 유사한 값을 가지는 단어들을 대체 후보 단어로

주어진 재료를 효과적으로 사용하였는가? 주어진 재료를 효과적으로 사용했다. 상 주어진 재료를 효과적으로 사용하지 못했다. 상 결과물이 미션의 목표를 일부

29는 고유번호가 321E B 6A 48인 태그 데이터를 수신한 결과 값을 보여주고 있다.위와 같이 국내외에서 실제 상용화되고 있는 태그를 이용하여 본 연구진에서 자 체 제작

하여 움직임을 검출하는 방법에는 화소 값을 기반으로 하는 방법과 차 영상의 히스토그램 을 이용하는 방법 그리고 움직임 예측을 통해 검출하는 방법과 학습된

그러나 학습시간이 경과됨에 따라 생성자 모델은 훈련 데이터 와 비슷한 분포를 가진 모조 데이터를 생성할 수 있고 이는 GAN 모델의 학습 능력이 향상되어가고 있음을

제안된 방법론은수집된 운용 환 경 데이터를 그룹화 하여 다양한 환경에 따른 제품의 성능 감소 값을 파악하고, 환경 의 분포를 파악하여 제품의 잔여유효수명을