본문 바로가기
2/[ Machine Learning ]

[GAN] GAN: Generative Adversarial Nets

by Kieran_Han 2021. 2. 3.

Source: arxiv.org/abs/1406.2661

 

Generative Adversarial Networks

We propose a new framework for estimating generative models via an adversarial process, in which we simultaneously train two models: a generative model G that captures the data distribution, and a discriminative model D that estimates the probability that

arxiv.org

 

GAN(Generative Adversarial Nets): Generator(생성자)와 Distriminator(판별자)가 대립하며 학습하는 신경망

→ 실제 자료(x)와 동일한 분포를 가지는 자료를 생성하는 생성자(G)와 실제 자료와 생서자료를 구별하는 판별자(D)가 서로 대립하며 최적화를 수행해 나가는 모델

 

Generator(G): 실제 자료와 같은 자료를 만들기 위해 갖고 있는 Data의 x의 distribution을 알아내려고 노력

Distriminator(D): 실제 자료와 생성자료를 구분하기 위해 sample이 Training Data인지 G가 생성한 것인지 파악

Goal: 최종적으로 Generator가 실제 자료와 같은 자료를 만드는 것

 

GAN Value Function:

    - Pd, Pz = x, z의 분포

 

D는 실제 자료 x에 대해서 D(x)=1이 되도록 노력

G에 임의의 noise distribution으로부터 뽑은 input z로 만들어진 sample(G(z))에 대해서 D(G(x))=0이 되도록 행동

→ D는 생성자료와 실제 자료를 잘 구분하려고 행동하고 G는 실제 자료와 아주 유사한 자료를 생성하며 D(G(z))=1이 되도록 행동

→ 결과적으로 G가 D가 생성한 자료를 구별할 확률 Pd=0.5에 이르게 됨

 

 

From the source papaer

검은 점선(Pdata): Data Generating Distribution

파란 점선(Pd): Discriminator Distribution

녹색 실선(Pg): Generative Distribution

x, z선: 각각 x와 z의 domain

x, z선 사이 화살표: x=G(z)의 mapping

 

처음에는 그림(a)와 같이 Pdata와 Pg가 전혀 다름

Discriminator가 Pdatda와 Pg를 구별하기 위해 학습하면 그림(b)와 같이 유연하게 잘 구별할 수 있도록 분포가 변함

Generator는 Discriminator가 구별하기 어렵도록 학습하여 그림(c)와 같이 Pg가 Pdata와 흡사해짐

최종적으로 Pg=Pdata가 되어 Discriminator가 둘을 구별하지 못하는 D(x)=0.5가 됨

 

주어진 생성자에서 판별자가 최적의 값을 가질 때 GAN의 Value Function은

    - Pg: Generative Distribution

    - Pdata: Data Generating Distribution

    - KL(Kullback-Leibler divergence)과 JSD(Jenson-Shannon divergence)는 두 분포 간의 거리를 나타내는 측도

    - JSD는 0 이상의 값을 가지며 두 분포가 같으면 0

    - C(G)는 전역 최솟값으로 -log(4)를 가짐

 

GAN 문제점

1. Discriminator와 Generator가 최적 상태인 Nash Equilibrium에 도달하기 위해서 각각의 가치함수를 구해 학습이 진행되지만 실제로는 수렴이 보장되지 않는다

2. Generator가 다양한 실제 자료를 폭 넓게 생성하지 못하고 일부 자료만을 생성하게되는 Mode Collapse 현상 발생